Prisma Migrate - Drift detected error on each migrate run even when nothing changes in DB/Schema
See original GitHub issueBug description
Reopening #5282 with only the drift detected issue.
I get drift detected error every time I run Prisma migrate dev command even without making a single change to my schema. I migrated my existing database to Prisma and introspected it. Also created an init migration using SQL dump so that my schema, migrations and database all are in sync. Everything works fine for me including migrations creation using prisma migrate but the drift detected comes up every time.
How to reproduce
Not sure. Have already shared my schema file earlier with @pimeys
Expected behavior
Shouldn’t get drift detected error since everything is in sync
Prisma information
Environment & setup
- OS: MacOS Catalina 10.15.1, Running inside docker
node:14.15.4-alpine - Database: PostgreSQL
- Node.js version: v14.15.4
- Prisma version:
prisma : 2.17.0
@prisma/client : 2.17.0
Current platform : linux-musl
Query Engine : query-engine 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/query-engine-linux-musl)
Migration Engine : migration-engine-cli 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/migration-engine-linux-musl)
Introspection Engine : introspection-core 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/introspection-engine-linux-musl)
Format Binary : prisma-fmt 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/prisma-fmt-linux-musl)
Studio : 0.353.0
Preview Features : createMany
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >Prisma 2.17.0 Release - GitClear
Database resets in the context of Prisma Migrate now gracefully fall back to dropping constraints, indexes and tables, if there are insufficient ...
Read more >Command Line Interface | RedwoodJS Docs
Appends a DataMigration model to schema.prisma for tracking which data migrations have already run. Creates a DB migration using yarn redwood prisma migrate...
Read more >Prisma migration is bad state - Stack Overflow
Connect the project to your backup database and run prisma migrate dev --name baseline_migration . This will generate a migration matching ...
Read more >@prisma/cli: Versions | Openbase
Prisma Client Go continues to get more powerful every release. ... Migrate - Drift detected error on each migrate run even when nothing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @codeslayer1 — @pimeys provided me with the schema and the migrations and I spent some time reproducing your issue. The problem is that your first migration redefines the Prisma migrations table. If you delete this part of the migration, the drift goes away:
Hey @tomhoule. This worked. Thanks a lot. Couldn’t have guessed this fix 😅