Editing 11 applied migrations in 9c082eb (BUNYIP-79) crash-loops already-migrated DBs on _sqlx_migrations checksum mismatch #172
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip#172
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Commit
9c082eb("fix(migrations): close data-integrity gaps and gate version collisions", BUNYIP-79) edits 11 already-applied migration files in place. sqlx records a per-file SHA-384 in_sqlx_migrationson first apply and recomputes + compares it on every subsequent start, so any DB that already applied the originals now fails startup withmigration <version> was previously applied but has been modifiedand crash-loops until the recorded checksums are reconciled by hand. The commit message andbunyip-api/migrations/README.mdboth call out this checksum caveat, but the reconciliation is fully manual and nothing in the deploy path performs or enforces it, so an existing environment that pulls the change just goes dark.Impact (observed)
A developer dev OP (
dev-bunyip-api-long) was down for ~24h, crash-looping on:With the API process dead, Traefik had no backend and every dependent relying party failed (in this case a lets-chat dev stack could not complete OIDC discovery). It was only recovered by manually realigning the recorded checksums in
_sqlx_migrationsto the current file hashes.Affected migrations (all 11 edited in
9c082eb)Why the documented caveat is not enough
The README says to "reconcile the recorded checksum (or confirm the environment re-migrates from scratch) before deploying," but:
_sqlx_migrationsper affected version (error-prone, and easy to miss in an unattended dev/CI deploy that just restarts the container).Suggested remediation (pick one)
bunyip-bootstrapsubcommand or a script) that updates the recorded SHA-384 for the affected versions, and run it automatically beforemigrateon startup, so no environment crash-loops.Reference
Sha384::digest(file_bytes)insqlx-core/src/migrate/migration.rs.