Prisma model change without data loss
I am working on a t3 project and currently only have one database. I want to change the type of a column in a model but when trying to use db push I am asked to reset the database.
After looking around and asking Chatgpt, I tried using Prisma migrate dev but I am given a similar message about my Prisma schema not being in sync with my migration history and am again prompted to reset the db. Is there anyway I can fix the drift and make changes to the schema without resetting?
2 Replies
idk what your data model looks like but you probably need to customize the migration to either convert to the new data type in-place or store it in another column, delete the first and rename or something https://www.prisma.io/docs/guides/migrate/developing-with-prisma-migrate/customizing-migrations
Prisma
Customize a migration file
How to edit a migration file before applying it to avoid data loss in production.
Ok, thank you for the quick response and something to go off of.