Repository navigation
ci(db): fail the build when the Prisma schema and migrations drift apart (#1691) - #1782
Merged
GauravKarakoti merged 3 commits intoNov 15, 2026
Conversation
|
@ChandanVarshney031 is attempting to deploy a commit to the Gaurav's projects Team on Vercel. A member of the Team first needs to authorize it. |
…breakers in AI test suites
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.
Resolves #1691
Problem
A contributor can change
prisma/schema.prismaand forget to commit the matching migration (or the reverse). The mistake only shows up later as a runtime error on a fresh deployment or in the Docker entrypoint's migration step.Solution
db:check-driftScript: Added"db:check-drift": "prisma migrate diff --from-migrations prisma/migrations --to-schema prisma/schema.prisma --exit-code"topackage.jsonso contributors can verify locally thatschema.prismaand migrations stay synchronized.prisma-drift-checkjob in.github/workflows/ci.ymlto runnpm run db:check-driftagainst a PostgreSQL 16 container and shadow database (SHADOW_DATABASE_URL), failing the job with an explicit message (::error::Schema drift detected. Run 'npx prisma migrate dev --name <change>' and commit the new migration.) if drift (exit code 2) is detected.npm run db:check-driftunder Database Setup and Before Submitting checklist inCONTRIBUTING.md.npm run db:check-driftand shadow database requirement inprisma/README.md.SHADOW_DATABASE_URLreference in.env.example.tests/prisma-drift-check.test.tscovering script definition, CI job structure, documentation references, and diff exit codes (exit 0 for clean schema, exit 2 for unmigrated drift).CircuitBreakerErrorinsrc/ai/flows/web3-security-explanations.fallback.test.tsto ensure typecheck passes cleanly.Acceptance Criteria Verification
CONTRIBUTING.mddocuments the local command.