Skip to content

Commit

Permalink
Cascade category deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
GAsplund committed Oct 5, 2024
1 parent 4b104a8 commit 8804d22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ CREATE TABLE "NavbarItem" (
);

-- AddForeignKey
ALTER TABLE "NavbarItem" ADD CONSTRAINT "NavbarItem_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "NavbarCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE "NavbarItem" ADD CONSTRAINT "NavbarItem_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "NavbarCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ model NavbarItem {
nameSv String
nameEn String
url String
category NavbarCategory @relation(fields: [categoryId], references: [id])
category NavbarCategory @relation(fields: [categoryId], references: [id], onDelete: Cascade)
categoryId Int
}

0 comments on commit 8804d22

Please sign in to comment.