add teamId to email events (#194)

This commit is contained in:
KM Koushik
2025-08-10 08:58:17 +10:00
committed by GitHub
parent 7ecb3d27a9
commit 46b2b64847
6 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `teamId` to the `EmailEvent` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "EmailEvent" ADD COLUMN "teamId" INTEGER NOT NULL;
-- CreateIndex
CREATE INDEX "EmailEvent_teamId_idx" ON "EmailEvent"("teamId");
-- AddForeignKey
ALTER TABLE "EmailEvent" ADD CONSTRAINT "EmailEvent_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -117,7 +117,8 @@ model Team {
dailyEmailUsages DailyEmailUsage[]
subscription Subscription[]
invites TeamInvite[]
SuppressionList SuppressionList[]
suppressionList SuppressionList[]
emailEvents EmailEvent[]
}
model TeamInvite {
@@ -261,10 +262,13 @@ model EmailEvent {
emailId String
status EmailStatus
data Json?
teamId Int
createdAt DateTime @default(now())
email Email @relation(fields: [emailId], references: [id], onDelete: Cascade)
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
@@index([emailId])
@@index([teamId])
}
model ContactBook {