Repository navigation
fix(prisma): reorder webhook query indexes migration after table creation - #629
Open
OAKVISUALZ wants to merge 1 commit into
Open
OAKVISUALZ wants to merge 1 commit into
OAKVISUALZ wants to merge 1 commit into
Conversation
…le creation Prisma deploys migrations in lexicographical order by directory name. Because ASCII '0' precedes 'a', 20261003_001_add_webhook_query_indexes sorted before 20261003_add_missing_models, causing 'CREATE INDEX ON user_webhook_deliveries' to fail with relation does not exist. Renamed migration to 20261004000000_add_webhook_query_indexes so it runs after table creation, added recovery handling to fix-and-deploy-migrations.sh, and documented the incident in docs/MIGRATIONS.md.
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.
Description
Fixes the CI failure in
Node CIwherenpx prisma migrate deploycrashed with:Root Cause
Prisma discovers and runs migrations in lexicographical (alphabetical) order by directory name. Because ASCII
'0'(48) precedes ASCII'a'(97),20261003_001_add_webhook_query_indexessorted and executed before20261003_add_missing_models.Since
user_webhook_deliveriesis defined and created inside20261003_add_missing_models, any fresh database deployment failed when20261003_001_add_webhook_query_indexesattempted to create an index on the nonexistent table.Solution
prisma/migrations/20261003_001_add_webhook_query_indexes->prisma/migrations/20261004000000_add_webhook_query_indexesUsing the standard 14-digit timestamp ensures it reliably executes after
20261003_add_missing_models.20261003_001_add_webhook_query_indexestoFIXED_MIGRATIONSinfix-and-deploy-migrations.shto allow automatic recovery on environments where the failed migration was recorded in_prisma_migrations.docs/MIGRATIONS.md(§A.4).Type of Change
Checklist
rollback.sqlships with the migration and is idempotentdocs/MIGRATIONS.md