Jawad Sefiani
05/05/2022, 12:28 AMprisma migrate dev is overwriting a custom migration that I wrote to alter one of my tables, this is the custom SQL script (I first created an empty migration using --create-only):
-- AlterTable
ALTER TABLE "menu-item-translations"
DROP CONSTRAINT "menu-item-translations_menuItemId_fkey",
ADD CONSTRAINT "menu-item-translations_menuItemId_fkey"
FOREIGN KEY ("menuItemId") REFERENCES "menu-items"("id") ON DELETE CASCADE ON UPDATE CASCADE;
After that I ran prisma migrate dev but it creates another migration (which i don't want because it removes the cascade behavior, idk why Prisma is doing this???):
-- DropForeignKey
ALTER TABLE "menu-item-translations" DROP CONSTRAINT "menu-item-translations_menuItemId_fkey";
-- AddForeignKey
ALTER TABLE "menu-item-translations" ADD CONSTRAINT "menu-item-translations_menuItemId_fkey" FOREIGN KEY ("menuItemId") REFERENCES "menu-items"("id") ON DELETE SET NULL ON UPDATE CASCADE;