Skip to content

Commit

Permalink
chore: Add Invitation model and migration (#4269)
Browse files Browse the repository at this point in the history
* Add Invitation model and migration

* Remove role column for now
  • Loading branch information
dsamojlenko committed Sep 16, 2024
1 parent 5d9a24b commit 3c4bf72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- CreateTable
CREATE TABLE "Invitation" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
"templateId" TEXT NOT NULL,

CONSTRAINT "Invitation_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "Invitation" ADD CONSTRAINT "Invitation_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
11 changes: 10 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ model Template {
bearerToken String?
ttl DateTime?
users User[]
closingDate DateTime? @db.Timestamptz(6)
closingDate DateTime? @db.Timestamptz(6)
invitations Invitation[]
}

model DeliveryOption {
Expand Down Expand Up @@ -145,3 +146,11 @@ model MagicLink {
token String @unique
expires DateTime
}

model Invitation {
id String @id @default(cuid())
email String
expires DateTime
templateId String
template Template @relation(fields: [templateId], references: [id], onDelete: Cascade, onUpdate: NoAction)
}

0 comments on commit 3c4bf72

Please sign in to comment.