feat: delete questions from frontpage on deletion

This commit is contained in:
Vyacheslav Matyukhin 2022-06-03 20:03:13 +03:00
parent ceeeff9681
commit 00615c1e63
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
-- DropForeignKey
ALTER TABLE "FrontpageId" DROP CONSTRAINT "FrontpageId_id_fkey";
-- AddForeignKey
ALTER TABLE "FrontpageId" ADD CONSTRAINT "FrontpageId_id_fkey" FOREIGN KEY ("id") REFERENCES "questions"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -90,6 +90,6 @@ model History {
} }
model FrontpageId { model FrontpageId {
question Question @relation(fields: [id], references: [id]) question Question @relation(fields: [id], references: [id], onDelete: Cascade)
id String @unique id String @unique
} }