P
Prisma11mo ago
tyler4949

P3005 Error running Prisma migrate

I am working on a NextJS project that uses prisma. I was able to define my initial schemas and deploy my initial migrations successfully. I made a small change in the diff screenshot attached to this message and I am able to run npx run db push with no issues. When I try to run npx prisma migrate dev to generate a migration, I get the following error:
Error: P3005

The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
Error: P3005

The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
I understand I can follow the docs to basically reset my migration history, but I would rather understand how to do this properly, because I would imagine I shouldn't be starting from scratch every time I make a scehma change? Any ideas what I did wrong?
No description
1 Reply
tyler4949
tyler4949OP11mo ago
Update: I ran the suggested commands on the baselining docs and while this worked I lost all the data in my db. This is not a huge deal because it was just test data while I learn Prisma, but how can I ensure this doesn't happen again as my project scales? Also, following the steps in the docs didnt regenerate a new migration_lock.toml file. This is also an issue, correct?

Did you find this page helpful?