fix(db): fail-closed drizzle journal gate before migrate - #736
Open
btipling wants to merge 1 commit into
Open
Conversation
drizzle-kit migrate only applies tags in meta/_journal.json. SQL on disk without a journal entry is a silent success (0012–0014 / #735). Gate scripts/drizzle-journal-gate.mjs so GHA db-migrate, DEK-backfill migrate, npm test, and npm run db:migrate die if SQL files and journal tags diverge.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
`drizzle-kit migrate` only applies tags in `meta/_journal.json`. SQL on disk without a journal entry is a silent no-op — that is how Skills stayed unavailable after green db-migrate runs (#735).
This adds `scripts/drizzle-journal-gate.mjs`: every `db/migrations/*.sql` must have a matching journal tag (and vice versa; idx sequential; no dupes). Fail closed before mutate.
Today the gate passes: 15 SQL files match the journal (0012–0014 landed in #735). A replay of the old journal (stop at 0011) would have failed the job instead of reporting success.