Issue with migrations

Hi! I've been trying to apply a change to my schema but been facing some errors and im not sure what im doing wrong, do you think you can help me please? I tried to add a new table to my prisma schema, but every time i try to apply the migration with npx prisma migrate dev --name sample_name i get a message saying that a foreign key on one of the tables i had already on the schema was removed and then added again. Im not sure where this change comes from or if it could be a bug. That same message asks me to restart my database and that all data will be lost. I dont want my data to be lost, so i tried to do a baselining. As the documentation states y moved my migration folder and followed the steps, when i tried to do the migration again i got an error saying that all of the migration folders were missing on my folder, so i restored it. I also used npx prisma migrate status to check if any migration was still not applied, but all i got is that the schema was up to date. Then i tried doing an npx prisma migrate deploy, as i understood that this would apply all the pending migrations and sync database - schema. The command ran okay, but when i repeat the process of db pull -> prisma generate -> prisma migrate dev i get the same changes on my foreign keys and the alert that all data will be lost. Am i missing some step or am i doing something wrong? Even with the original prisma.schema thats generated with the npx prisma db pull command i keep getting the same message when doing an migration. I dont want to lose my database info and i would like to be able to apply changes to the schema in the future. Thank you for your help!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server