111 lines
3.1 KiB
Plaintext
111 lines
3.1 KiB
Plaintext
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String?
|
|
access_token String?
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String?
|
|
session_state String?
|
|
oauth_token_secret String?
|
|
oauth_token String?
|
|
refresh_token_expires_in Int?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
accounts Account[]
|
|
sessions Session[]
|
|
typebots Typebot[]
|
|
folders DashboardFolder[]
|
|
plan Plan @default(FREE)
|
|
}
|
|
|
|
enum Plan {
|
|
FREE
|
|
PRO
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
model DashboardFolder {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
name String
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
ownerId String
|
|
parentFolderId String?
|
|
parentFolder DashboardFolder? @relation("ParentChild", fields: [parentFolderId], references: [id])
|
|
childrenFolder DashboardFolder[] @relation("ParentChild")
|
|
typebots Typebot[]
|
|
}
|
|
|
|
model Typebot {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now())
|
|
name String
|
|
ownerId String
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
publishedTypebotId String?
|
|
publishedTypebot PublicTypebot?
|
|
results Result[]
|
|
folderId String?
|
|
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
|
blocks Json[]
|
|
startBlock Json
|
|
}
|
|
|
|
model PublicTypebot {
|
|
id String @id @default(cuid())
|
|
typebotId String @unique
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
steps Json[]
|
|
name String
|
|
blocks Json[]
|
|
startBlock Json
|
|
}
|
|
|
|
model Result {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @default(now())
|
|
typebotId String
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
}
|