How to Fix "Migration failed to apply cleanly to the shadow database" in Prisma
I ran into an error while using Prisma earlier today. I made an update to my Prisma schema and used Prisma Migrate to keep it in sync with my database schema.
I ran the following command.
npx prisma migrate dev --preview-feature
This resulted in the following error.
Migration `20210512184650_remove_user_table`
failed to apply cleanly to the shadow database.
Generally, we have two options for synchronizing our Prisma and database schema.
We can either use Prisma Migrate or db push
.
If we are just prototyping and working in a development environment, we can use db push
in order to prioritize the actual schema synchronization over the generated migration files.
npx prisma db push --preview-feature