1

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?

hellvisor
  • 463
  • 5
  • 15

2 Answers2

5

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*
hellvisor
  • 463
  • 5
  • 15
1

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:

  • If you're okay with losing the data in the database, try resetting the database with prisma migrate reset. More info
  • Try running introspection to capture any changes to the database with prisma introspect before applying a new migration. More info
Tasin Ishmam
  • 5,670
  • 1
  • 23
  • 28