dekinaiyo
dekinaiyo
PPrisma
Created by dekinaiyo on 7/2/2024 in #help-and-questions
Migrate dev failing in a project it used to work in. Says issue w/ user defined functions.
So this seems to have worked but I don’t really like that I had to essentially disregard my entire migration history and re-baseline. I don’t know what happened that made it work a year and a half ago but not work now without the re-baseline.
3 replies
PPrisma
Created by dekinaiyo on 7/2/2024 in #help-and-questions
Migrate dev failing in a project it used to work in. Says issue w/ user defined functions.
I managed to apply new migrations but the way I did it just feel so gross 😖 What I did was rename the migrations folder in the project, then delete all the migration records from the database. After that I ran pg_dump to get the schema from the database. Then I created a new migrations folder and put a timestamp_fresh_init folder in there and moved the schema.sql file from the pg_dump in there and renamed it to migrations.sql. Then I removed some of the stuff from the file that was not need, some of the setup at the top. After that I ran migrate resolve for the fresh init migration. I then checked the Prisma table in the database to be sure and there was indeed only one migration, the new baseline that contains the entire schema from the dump file. After doing that I was able to successfully run migrate dev create only. When I did so it found some changes that it said would need to be run but I was confused because it wanted to create a few tables that already existed. What I did was just edit the new migration file that was created to only have the info I wanted to put in (the rbac tables I was creating). Then I ran migrate deploy and my changes were successfully applied to the database. I was able to do it twice in a row, I added some sessions and connections tables after. The same odd thing happened where it was like “new index will be created” but the index for sure already exists in the database and the index wasn’t related to the change I had made in my Prisma schema file so I just manually discarded them and then ran migrate deploy and it also worked.
3 replies