PrismaP
Prisma4mo ago
4 replies
Mak SM

Best practice for making manual database changes that are incompatible with completed migrations

After bringing up the issue with the AI bot here: https://discord.com/channels/937751382725886062/1420316663349252136

I've been trying to figure out the best course of action for running prisma migrations on a table that has been manually edited. From this discussion my understanding is that I shouldn't ever make a change to the table that doesn't make it forever backwards and forwards compatible or else I have to do a db reset every time. The need to reset my db every time A) won't work in production and B) means locally all of my test data is deleted which would take me forever to add back in especially if the schema is even slightly different (previous times I've tried to re import seed data if the data has any unused columns or tables the whole import fails instead of ignoring them).

What's the solution? Don't ever make any changes manually? Make changes that are always backwards compatible? Always be okay with doing `db reset and just manually re add the data?

Migrations have been the biggest headache so far dealing with prisma and has made me consider using a different library or method for managing my databases multiple times because it feels like every time I run npx prisma migrate dev there's a 70% chance it's going to fail or tell me to reset my database which concerns me for once it's in production.
Was this page helpful?