Wire pre-migration auto-backup with named API and manifest (B2/backup precursor)
Before running any pending migration, take a synchronous snapshot of the profile to backups/pre-migration-v<target>-<ts>/ and write a backup-manifest.json recording reason, schema version, app version, and git SHA. A failed migration now has a well-labelled recovery point instead of a half-upgraded profile. - createAutomaticBackup(reason): synchronous snapshot via VACUUM INTO + recursive cpSync of logs/artifacts, plus JSON manifest. No fallback — failure throws so the caller refuses to touch the schema. - runMigrations accepts createAutomaticBackup and invokes it when any migration is pending. No optional chaining; callers must supply it. - AppDatabase constructor takes appVersion so main-runtime stamps the manifest with app.getVersion().
This commit is contained in:
1 parent
08427931b6
commit
dade5eb333
5 files changed
+125
-6
No files matched your search
@@ -159,6 +159,7 @@ export class AppDatabase extends AppDatabaseBase {
|
||||
// ─── Backup ────────────────────────────────────────────────────────────────
|
||||
|
||||
exportBackup(targetDir: string) { return this.backupMod.exportBackup(targetDir); }
|
||||
createAutomaticBackup(reason: string) { return this.backupMod.createAutomaticBackup(reason); }
|
||||
async restoreFromBackup(sourceDir: string) { return this.backupMod.restoreFromBackup(sourceDir); }
|
||||
|
||||
// ─── Thread Runtime ────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user