Problem
When caling prisma migrate dev, the schema validation happens to late in the process. If there is a migration history conflict or database drift, Prisma Migrate will ask to reset the development database.
After the database is reset, then Prisma Migrate will try to generate a new migration but fail with an error if the PSL is invalid.
How to reproduce
- Make sure database is in sync with Prisma schema using native type notation
- Disable the feature flag but keep the native types notation -> This makes the schema invalid
- Cause drift on the database
- Make some new changes to the Prisma schema
- Run
prisma migrate dev
Solution
Always validate the schema first
Problem
When caling
prisma migrate dev, the schema validation happens to late in the process. If there is a migration history conflict or database drift, Prisma Migrate will ask to reset the development database.After the database is reset, then Prisma Migrate will try to generate a new migration but fail with an error if the PSL is invalid.
How to reproduce
prisma migrate devSolution
Always validate the schema first