mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
fix: delete tickets when their category is deleted (closes #384)
This commit is contained in:
parent
a43801edf1
commit
bd1bc19548
@ -239,7 +239,7 @@ ALTER TABLE `questionAnswers` ADD CONSTRAINT `questionAnswers_userId_fkey` FOREI
|
|||||||
ALTER TABLE `tags` ADD CONSTRAINT `tags_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `guilds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
ALTER TABLE `tags` ADD CONSTRAINT `tags_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `guilds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE `tickets` ADD CONSTRAINT `tickets_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `categories`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
ALTER TABLE `tickets` ADD CONSTRAINT `tickets_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `categories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE `tickets` ADD CONSTRAINT `tickets_claimedById_fkey` FOREIGN KEY (`claimedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
ALTER TABLE `tickets` ADD CONSTRAINT `tickets_claimedById_fkey` FOREIGN KEY (`claimedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
@ -188,7 +188,7 @@ model Ticket {
|
|||||||
archivedMessages ArchivedMessage[]
|
archivedMessages ArchivedMessage[]
|
||||||
archivedRoles ArchivedRole[]
|
archivedRoles ArchivedRole[]
|
||||||
archivedUsers ArchivedUser[]
|
archivedUsers ArchivedUser[]
|
||||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
||||||
categoryId Int?
|
categoryId Int?
|
||||||
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
||||||
claimedById String? @db.VarChar(19)
|
claimedById String? @db.VarChar(19)
|
||||||
|
@ -255,7 +255,7 @@ ALTER TABLE "questionAnswers" ADD CONSTRAINT "questionAnswers_userId_fkey" FOREI
|
|||||||
ALTER TABLE "tags" ADD CONSTRAINT "tags_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "guilds"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
ALTER TABLE "tags" ADD CONSTRAINT "tags_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "guilds"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE "tickets" ADD CONSTRAINT "tickets_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
ALTER TABLE "tickets" ADD CONSTRAINT "tickets_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE "tickets" ADD CONSTRAINT "tickets_claimedById_fkey" FOREIGN KEY ("claimedById") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
ALTER TABLE "tickets" ADD CONSTRAINT "tickets_claimedById_fkey" FOREIGN KEY ("claimedById") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
@ -187,7 +187,7 @@ model Ticket {
|
|||||||
archivedMessages ArchivedMessage[]
|
archivedMessages ArchivedMessage[]
|
||||||
archivedRoles ArchivedRole[]
|
archivedRoles ArchivedRole[]
|
||||||
archivedUsers ArchivedUser[]
|
archivedUsers ArchivedUser[]
|
||||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
||||||
categoryId Int?
|
categoryId Int?
|
||||||
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
||||||
claimedById String? @db.VarChar(19)
|
claimedById String? @db.VarChar(19)
|
||||||
|
@ -176,7 +176,7 @@ CREATE TABLE "tickets" (
|
|||||||
"referencesMessageId" TEXT,
|
"referencesMessageId" TEXT,
|
||||||
"referencesTicketId" TEXT,
|
"referencesTicketId" TEXT,
|
||||||
"topic" TEXT,
|
"topic" TEXT,
|
||||||
CONSTRAINT "tickets_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT "tickets_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
CONSTRAINT "tickets_claimedById_fkey" FOREIGN KEY ("claimedById") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT "tickets_claimedById_fkey" FOREIGN KEY ("claimedById") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT "tickets_closedById_fkey" FOREIGN KEY ("closedById") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT "tickets_closedById_fkey" FOREIGN KEY ("closedById") REFERENCES "users" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT "tickets_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
CONSTRAINT "tickets_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "users" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
@ -187,7 +187,7 @@ model Ticket {
|
|||||||
archivedMessages ArchivedMessage[]
|
archivedMessages ArchivedMessage[]
|
||||||
archivedRoles ArchivedRole[]
|
archivedRoles ArchivedRole[]
|
||||||
archivedUsers ArchivedUser[]
|
archivedUsers ArchivedUser[]
|
||||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
category Category? @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
||||||
categoryId Int?
|
categoryId Int?
|
||||||
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
claimedBy User? @relation(name: "TicketsClaimedByUser", fields: [claimedById], references: [id])
|
||||||
claimedById String?
|
claimedById String?
|
||||||
|
Loading…
Reference in New Issue
Block a user