I am working on upgrading a prisma project from v5 to latest v7. I am currently stuck on upgrading from v5 to v6 because that requires an index change for the Schema change for implicit m-n relations on PostgreSQL. The recommend solution is
However, that locks my database and especially in prod is not really ideal. I have seen proposed solution of doing migration outside of the file and either add
IF Not Exists
IF Not Exists
or mark the migration as resolved
The other solution I have seen is to run this process concurrently and as of
7.4.0
7.4.0
that seems like it's supported
And lastly someone mentioned if the unique index already exists you can just do
ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_AB_pkey" PRIMARY KEY USING INDEX "_PostToTag_AB_unique";
ALTER TABLE "_PostToTag" ADD CONSTRAINT "_PostToTag_AB_pkey" PRIMARY KEY USING INDEX "_PostToTag_AB_unique";
To set the metadata and use the previously made index as the new primary key. I wanted to see if other people also had this issue and if they tried any of the above solutions with success.