From 488464e3e786214469e5ac898fd5fcbe5d7bdc56 Mon Sep 17 00:00:00 2001 From: Mythie Date: Tue, 27 Feb 2024 13:38:12 +1100 Subject: [PATCH] chore: add team to webhook model --- .../20240227023747_add_team_webhooks/migration.sql | 5 +++++ packages/prisma/schema.prisma | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 packages/prisma/migrations/20240227023747_add_team_webhooks/migration.sql diff --git a/packages/prisma/migrations/20240227023747_add_team_webhooks/migration.sql b/packages/prisma/migrations/20240227023747_add_team_webhooks/migration.sql new file mode 100644 index 000000000..62e556228 --- /dev/null +++ b/packages/prisma/migrations/20240227023747_add_team_webhooks/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Webhook" ADD COLUMN "teamId" INTEGER; + +-- AddForeignKey +ALTER TABLE "Webhook" ADD CONSTRAINT "Webhook_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index 3dd1a1997..76892ea59 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -115,6 +115,8 @@ model Webhook { updatedAt DateTime @default(now()) @updatedAt userId Int User User @relation(fields: [userId], references: [id], onDelete: Cascade) + teamId Int? + team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade) WebhookCall WebhookCall[] } @@ -417,6 +419,7 @@ model Team { document Document[] templates Template[] ApiToken ApiToken[] + Webhook Webhook[] } model TeamPending {