From 3803c3378ab86b9241ba7001e073b0aa21bc4822 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 5 Mar 2025 17:19:06 +0700 Subject: [PATCH] chore: migration --- .../migration.sql | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 prisma/migrations/20250305101414_add_mark_delete_noti/migration.sql diff --git a/prisma/migrations/20250305101414_add_mark_delete_noti/migration.sql b/prisma/migrations/20250305101414_add_mark_delete_noti/migration.sql new file mode 100644 index 0000000..5be0ce5 --- /dev/null +++ b/prisma/migrations/20250305101414_add_mark_delete_noti/migration.sql @@ -0,0 +1,48 @@ +/* + Warnings: + + - You are about to drop the `_NotificationToUser` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "_NotificationToUser" DROP CONSTRAINT "_NotificationToUser_A_fkey"; + +-- DropForeignKey +ALTER TABLE "_NotificationToUser" DROP CONSTRAINT "_NotificationToUser_B_fkey"; + +-- DropTable +DROP TABLE "_NotificationToUser"; + +-- CreateTable +CREATE TABLE "_NotificationRead" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + + CONSTRAINT "_NotificationRead_AB_pkey" PRIMARY KEY ("A","B") +); + +-- CreateTable +CREATE TABLE "_NotificationDelete" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + + CONSTRAINT "_NotificationDelete_AB_pkey" PRIMARY KEY ("A","B") +); + +-- CreateIndex +CREATE INDEX "_NotificationRead_B_index" ON "_NotificationRead"("B"); + +-- CreateIndex +CREATE INDEX "_NotificationDelete_B_index" ON "_NotificationDelete"("B"); + +-- AddForeignKey +ALTER TABLE "_NotificationRead" ADD CONSTRAINT "_NotificationRead_A_fkey" FOREIGN KEY ("A") REFERENCES "Notification"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_NotificationRead" ADD CONSTRAINT "_NotificationRead_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_NotificationDelete" ADD CONSTRAINT "_NotificationDelete_A_fkey" FOREIGN KEY ("A") REFERENCES "Notification"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_NotificationDelete" ADD CONSTRAINT "_NotificationDelete_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;