Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
Cascade delete participants
Luke Vella1707c5e0a05b
diff --git a/migrations/20220412115407_cascade_delete_participants/migration.sql b/migrations/20220412115407_cascade_delete_participants/migration.sqlnew file mode 100644index 000000000..11fc4ca27--- /dev/null+++ b/migrations/20220412115407_cascade_delete_participants/migration.sql@@ -0,0 +1,5 @@+-- DropForeignKey+ALTER TABLE "Participant" DROP CONSTRAINT "Participant_pollId_fkey";++-- AddForeignKey+ALTER TABLE "Participant" ADD CONSTRAINT "Participant_pollId_fkey" FOREIGN KEY ("pollId") REFERENCES "Poll"("urlId") ON DELETE CASCADE ON UPDATE CASCADE;diff --git a/schema.prisma b/schema.prismaindex 07d1349d5..2db2f67fa 100644--- a/schema.prisma+++ b/schema.prisma@@ -68,7 +68,7 @@ model Participant {name Stringuser User? @relation(fields: [userId], references: [id])userId String?- poll Poll @relation(fields: [pollId], references: [urlId])+ poll Poll @relation(fields: [pollId], references: [urlId], onDelete: Cascade)pollId Stringvotes Vote[]createdAt DateTime @default(now())