Repository navigation
fix(db): interrupted or failed migrations are no longer marked applied - #549
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tabases atomically Bun recorded a migration before running it, so a container stopped during its first start (or a migration failing half way) left a database that claimed a schema it lacked and crash-looped on 'no such column'. - both backends: migrate.WithMarkAppliedOnSuccess(true) - SQLite: a missing database is built as solidping.db.init, migrated, checkpointed and renamed; leftovers are deleted at start - SQLite: pending migrations on an existing database first write solidping.db.pre-<name>.bak (latest only, skipped under 2x free space) - startup data fixups explain a half-migrated database Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ook, close the spec Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #549 +/- ##
==========================================
- Coverage 83.08% 83.07% -0.01%
==========================================
Files 1197 1200 +3
Lines 123358 123466 +108
==========================================
+ Hits 102488 102573 +85
- Misses 20862 20885 +23
Partials 8 8
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the spec from #548 (included in this branch, moved to
specs/done/2026/10/).Stopping a container during its first start left a SQLite database that never started again (
no such column: organization.default_escalation_policy_uid). bun marked each migration applied before running it, so a killed or failing migration was skipped on the next boot.migrate.WithMarkAppliedOnSuccess(true). A failed or interrupted migration stays pending and runs again.solidping.db.init, checkpointed, then renamed. Leftover.initfiles are deleted at start.VACUUM INTO solidping.db.pre-<migration>.bakbefore pending migrations, latest only, skipped when free disk is under 2x the DB size. A migration error names the backup..tx.up.sql(documented inwiki/conventions/migrations.md). Existing files are not renamed.no such column/tableerror is wrapped as "database looks half-migrated", with a runbook entry.Tests: failed migration not recorded then retried (SQLite and embedded Postgres), interrupted/cancelled first boot leaves nothing, clean first boot leaves one file, backup cases.
Not done here: the manual docker check (
docker rm -f5 s into a fresh container, restart on the same volume,/api/mgmt/healthis 200).Closes #548
🤖 Generated with Claude Code