Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Invitation model and migration #4269

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE "Invitation" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
"role" TEXT 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;
12 changes: 11 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,12 @@ model MagicLink {
token String @unique
expires DateTime
}

model Invitation {
id String @id @default(cuid())
email String
expires DateTime
role String // future use
dsamojlenko marked this conversation as resolved.
Show resolved Hide resolved
templateId String
template Template @relation(fields: [templateId], references: [id], onDelete: Cascade, onUpdate: NoAction)
}
Loading