Reputation: 538
I have such problem as below
$ prisma migrate dev --name "ok"
Error: P3006
Migration `2021080415559_order_linking` failed to apply clearnly to the shadow database.
Error code: P1014
Error:
The underlying table for model 'Order' does not exist.
How to fix it?
Upvotes: 4
Views: 8516
Reputation: 7238
It looks like your migrations were corrupted somehow. There was probably changes to your database that was not recorded in the migration history.
You could try one of these:
prisma migrate reset
. More infoprisma introspect
before applying a new migration. More infoUpvotes: 3
Reputation: 538
The solution:
It seems that this may be due to the migration file in the prisma folder. I decided to delete the Migration Files and the whole folder with it. I restarted the application, it got a new file and it worked.
*delete the migrations folder*
$ prisma generate
$ prisma migrate dev --name "ok"
*it works*
Upvotes: 5