From 92a21ff4c5df6e9f771cfbd140835dce3b6d7b0d Mon Sep 17 00:00:00 2001
From: Sebastien Castiel <sebastien@castiel.me>
Date: Fri, 8 Dec 2023 14:56:51 -0500
Subject: Migration script, improvements in expenses list

---
 .../20231208195456_add_delete_cascade/migration.sql     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 prisma/migrations/20231208195456_add_delete_cascade/migration.sql

(limited to 'prisma/migrations/20231208195456_add_delete_cascade/migration.sql')

diff --git a/prisma/migrations/20231208195456_add_delete_cascade/migration.sql b/prisma/migrations/20231208195456_add_delete_cascade/migration.sql
new file mode 100644
index 0000000..80914fd
--- /dev/null
+++ b/prisma/migrations/20231208195456_add_delete_cascade/migration.sql
@@ -0,0 +1,17 @@
+-- DropForeignKey
+ALTER TABLE "Expense" DROP CONSTRAINT "Expense_groupId_fkey";
+
+-- DropForeignKey
+ALTER TABLE "Expense" DROP CONSTRAINT "Expense_paidById_fkey";
+
+-- DropForeignKey
+ALTER TABLE "ExpensePaidFor" DROP CONSTRAINT "ExpensePaidFor_participantId_fkey";
+
+-- AddForeignKey
+ALTER TABLE "Expense" ADD CONSTRAINT "Expense_groupId_fkey" FOREIGN KEY ("groupId") REFERENCES "Group"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "Expense" ADD CONSTRAINT "Expense_paidById_fkey" FOREIGN KEY ("paidById") REFERENCES "Participant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "ExpensePaidFor" ADD CONSTRAINT "ExpensePaidFor_participantId_fkey" FOREIGN KEY ("participantId") REFERENCES "Participant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- 
cgit v1.3

