Skip to content

Commit bcbc831

Browse files
ci: fix the schema drift check for Prisma 7
Prisma 7 dropped --shadow-database-url from migrate diff, so the step failed on its very first run with a usage error rather than a real finding. Replaced the migrations-replay form with a direct comparison of the database the migrations just produced against the schema. Same guarantee, no shadow database, and one fewer moving part. Verified in both directions locally before pushing: exit 0 when they agree, exit 2 with the added column named when they do not. A check that cannot fail is not a check.
1 parent 18a9529 commit bcbc831

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
- name: Apply migrations
5555
run: npx prisma migrate deploy
5656

57+
# Compares the database the migrations just produced against the schema.
58+
# A model changed without a migration fails here rather than diverging
59+
# quietly until someone deploys. `--exit-code` returns 2 on a difference;
60+
# verified locally in both directions, because a check that cannot fail is
61+
# not a check.
5762
- name: Check for schema drift
58-
run: |
59-
npx prisma migrate diff \
60-
--from-migrations prisma/migrations \
61-
--to-schema-datamodel prisma/schema.prisma \
62-
--shadow-database-url "$DATABASE_URL" \
63-
--exit-code && echo "schema and migrations agree"
63+
run: npx prisma migrate diff --from-config-datasource --to-schema prisma/schema.prisma --exit-code
6464

6565
- run: npm run db:seed
6666

0 commit comments

Comments
 (0)