mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-04 12:06:11 +01:00
Delete expense
This commit is contained in:
11
prisma/migrations/20231206195936_add_cascades/migration.sql
Normal file
11
prisma/migrations/20231206195936_add_cascades/migration.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ExpensePaidFor" DROP CONSTRAINT "ExpensePaidFor_expenseId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Participant" DROP CONSTRAINT "Participant_groupId_fkey";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Participant" ADD CONSTRAINT "Participant_groupId_fkey" FOREIGN KEY ("groupId") REFERENCES "Group"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ExpensePaidFor" ADD CONSTRAINT "ExpensePaidFor_expenseId_fkey" FOREIGN KEY ("expenseId") REFERENCES "Expense"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -21,7 +21,7 @@ model Group {
|
||||
model Participant {
|
||||
id String @id
|
||||
name String
|
||||
group Group @relation(fields: [groupId], references: [id])
|
||||
group Group @relation(fields: [groupId], references: [id], onDelete: Cascade)
|
||||
groupId String
|
||||
expensesPaidBy Expense[]
|
||||
expensesPaidFor ExpensePaidFor[]
|
||||
@@ -39,7 +39,7 @@ model Expense {
|
||||
}
|
||||
|
||||
model ExpensePaidFor {
|
||||
expense Expense @relation(fields: [expenseId], references: [id])
|
||||
expense Expense @relation(fields: [expenseId], references: [id], onDelete: Cascade)
|
||||
participant Participant @relation(fields: [participantId], references: [id])
|
||||
expenseId String
|
||||
participantId String
|
||||
|
||||
Reference in New Issue
Block a user