Skip to content

fix(backup): upgrade restored snapshots and keep the working db on failure - #193

Merged
sorenwacker merged 2 commits into
mainfrom
fix/restore-backup-migrations
Oct 15, 2026
Merged

sorenwacker merged 2 commits into
mainfrom
fix/restore-backup-migrations

Conversation

@sorenwacker

Copy link
Copy Markdown
Owner

Restoring a snapshot swapped in its handle directly. Snapshots taken before a migration (-pre-workspace-migration, -pre-tag-migration, documented as restorable) kept their old schema until the next restart, because _initSchema() only runs at startup. The old connection was never closed, and an unreadable file was adopted before anything checked it (sql.js only fails on the first query).

restoreBackup now queries the snapshot before adopting it, closes the previous connection after the switch, and runs _initSchema() on the restored database. The behaviour is documented in docs/reference/settings.md. The three tests in src/__tests__/restoreBackup.test.js were red before the change.

@sorenwacker
sorenwacker merged commit f50c841 into main Oct 15, 2026
7 checks passed
@sorenwacker
sorenwacker deleted the fix/restore-backup-migrations branch October 15, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant