Files
formbricks-formbricks/prisma/schema.prisma
2022-06-14 17:21:47 +09:00

86 lines
2.6 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum FormType {
CODE
NOCODE
}
enum PipelineType {
WEBHOOK
}
model Form {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
formType FormType @default(NOCODE)
name String
published Boolean @default(false)
finishedOnboarding Boolean @default(false)
schema Json
submissionSessions SubmissionSession[]
pipelines Pipeline[]
}
model Pipeline {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
type PipelineType
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
formId String
data Json
}
model SubmissionSession {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
formId String
userFingerprint String
events SessionEvent[]
}
model SessionEvent {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
submissionSession SubmissionSession @relation(fields: [submissionSessionId], references: [id], onDelete: Cascade)
submissionSessionId String
type String
data Json
}
model User {
id Int @id @default(autoincrement())
name String?
email String? @unique
emailVerified DateTime? @map(name: "email_verified")
password String?
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
forms Form[]
@@map(name: "users")
}
model VerificationRequest {
id Int @id @default(autoincrement())
identifier String
token String @unique
expires DateTime
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @map(name: "updated_at")
@@map(name: "verification_requests")
}