How to init migration with existing database
I already have a database and there is data in it. Now I want to use Prisma to connect with it .So I do following:
1. Create a schema.prisma file, config datasource and generator
2. Run
3. Run
But step 3 got error, Prisma tells me that my schema is not sync and prompts me to reset database. It will cause data lost so I can't do that.
But if I want to sync a new model (create a new table) added in schema.prisma file, I need to do a migration
How can I solve this problem without data lost?
1. Create a schema.prisma file, config datasource and generator
2. Run
prisma db pull to get latest schema3. Run
prisma migrate dev to init migration But step 3 got error, Prisma tells me that my schema is not sync and prompts me to reset database. It will cause data lost so I can't do that.
But if I want to sync a new model (create a new table) added in schema.prisma file, I need to do a migration
How can I solve this problem without data lost?