Drift detected after prisma migration dev and wants to reset the database?
See original GitHub issueTrying to to migrate from Prisma 1 to Prisma 2 and all seems to work, i.e. I can query my database fine. Except when running npx prisma migrate dev
which seems to think my schema is out of date and says We need to reset the PostgreSQL database
Is there a way I can tell Prisma that the schema in my database is the one I want to keep?
The flow I have done to migrate is as follows:
- Using pg_dump to pull down prisma 1 database
- Use pg_restore to upload copy of prisma 1 database to a new database
- Using npx prisma-upgrade to generate SQL commands to run on new database
- Running prisma introspect which shows successful (a few warnings These id fields were enriched with @default(cuid()) information taken from the previous Prisma schema. but shouldn’t be a blocker?)
- Run npx prisma generate and can succesfully generate my client which I can use to query data and all seems to work fine
- Run prisma migrate dev which is what doesn’t work Drift detected: Your database schema is not in sync with your migration history & We need to reset the PostgreSQL database
I don’t want to reset my database as I’ll lose all my data.
Is it possible to delete these migrations from somewhere so it thinks my database schema is up to date or will that cause issues downt the track?
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 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 Migrate limitations and known issues
You call prisma migrate reset explicitly; You call prisma migrate dev and Prisma Migrate detects drift in the database or a migration history...
Read more >Prisma Migrate | Database, Schema, SQL Migration Tool
Prisma Migrate is a database migration tool available via the Prisma CLI that integrates with Prisma schema for data modeling.
Read more >Prisma Migrate in development and production
This command: Reruns the existing migration history in the shadow database in order to detect schema drift (edited or deleted migration file, or...
Read more >Migration troubleshooting in production - Prisma
Fixing failed migrations with migrate diff and db execute · prisma migrate diff which diffs two database schema sources to create a migration...
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 FreeTop 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
Top GitHub Comments
@janpio haven’t been able to get the
migration dev
working yet but thinking the db push and pull is actually what we were after. We will be doing the actual migration next week so should (just been doing test runs for now) so can report back when we have more info.@janpio sure thing. Here is the new issue: #8124