2
0
Files
bot/packages/db/prisma/schema.prisma

121 lines
3.3 KiB
Plaintext
Raw Normal View History

2021-11-29 15:19:07 +01:00
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
2021-12-06 15:48:50 +01:00
provider = "prisma-client-js"
2021-11-29 15:19:07 +01:00
}
model Account {
2021-12-06 15:48:50 +01:00
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?
2021-11-29 15:19:07 +01:00
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 {
2021-12-06 15:48:50 +01:00
id String @id @default(cuid())
2021-11-29 15:19:07 +01:00
name String?
2021-12-06 15:48:50 +01:00
email String? @unique
2021-11-29 15:19:07 +01:00
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
2021-12-06 15:48:50 +01:00
typebots Typebot[]
folders DashboardFolder[]
plan Plan @default(FREE)
2021-12-27 15:59:32 +01:00
stripeId String? @unique
2021-12-06 15:48:50 +01:00
}
enum Plan {
FREE
PRO
2021-12-27 15:59:32 +01:00
LIFETIME
OFFERED
2021-11-29 15:19:07 +01:00
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
2021-12-06 15:48:50 +01:00
}
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])
2021-12-16 10:43:49 +01:00
blocks Json[]
startBlock Json
2021-12-23 09:37:42 +01:00
theme Json
2021-12-23 13:49:24 +01:00
settings Json
2021-12-23 15:20:21 +01:00
publicId String? @unique
2021-12-06 15:48:50 +01:00
}
model PublicTypebot {
2021-12-16 10:43:49 +01:00
id String @id @default(cuid())
typebotId String @unique
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
name String
blocks Json[]
startBlock Json
2021-12-23 09:37:42 +01:00
theme Json
2021-12-23 13:49:24 +01:00
settings Json
2021-12-23 15:20:21 +01:00
publicId String? @unique
2021-12-06 15:48:50 +01:00
}
model Result {
2021-12-23 09:37:42 +01:00
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
typebotId String
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
answers Json[]
isCompleted Boolean?
2021-12-06 15:48:50 +01:00
}