resolveSQLiteDBPath returns the SQLite database path using the SAME precedence the server uses (PAD_DB_PATH > PAD_DATA_DIR/pad.db > ~/.pad/pad.db), via the shared config loader rather than a hardcoded HOME path. This keeps the backup/restore/migrate commands in sync with wherever the server actually
()
| 53 | // actually stores its database — notably PAD_DATA_DIR=/data inside the Docker |
| 54 | // image, and non-HOME layouts on Windows. |
| 55 | func resolveSQLiteDBPath() (string, error) { |
| 56 | cfg, err := config.Load() |
| 57 | if err != nil { |
| 58 | return "", fmt.Errorf("load config: %w", err) |
| 59 | } |
| 60 | return cfg.DBPath, nil |
| 61 | } |
| 62 | |
| 63 | // backupSQLite writes an online-safe, self-contained copy of the SQLite |
| 64 | // database at srcPath to outPath using `VACUUM INTO`. Unlike an io.Copy of the |
no test coverage detected