Search code examples
nestjsprismaprisma2

The underlying table for model 'Order' does not exist. Error code: P1014 (Prisma)


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?


Solution

  • 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*