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 {
|
2022-02-24 11:13:19 +01:00
|
|
|
id String @id @default(cuid())
|
2022-02-24 14:52:35 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
lastActivityAt DateTime @default(now())
|
2022-02-24 11:13:19 +01:00
|
|
|
name String?
|
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
|
|
|
image String?
|
|
|
|
accounts Account[]
|
|
|
|
sessions Session[]
|
|
|
|
typebots Typebot[]
|
|
|
|
folders DashboardFolder[]
|
|
|
|
plan Plan @default(FREE)
|
|
|
|
stripeId String? @unique
|
|
|
|
credentials Credentials[]
|
|
|
|
customDomains CustomDomain[]
|
|
|
|
apiToken String?
|
|
|
|
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
2022-03-28 17:07:47 +02:00
|
|
|
company String?
|
|
|
|
onboardingCategories String[]
|
2022-02-18 14:57:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model CustomDomain {
|
2022-03-22 07:43:00 +01:00
|
|
|
name String @id
|
2022-02-24 14:52:35 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
ownerId String
|
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
2022-01-18 18:25:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credentials {
|
2022-02-24 14:52:35 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
ownerId String
|
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
|
|
data String // Encrypted data
|
|
|
|
name String
|
|
|
|
type String
|
|
|
|
iv String
|
2022-01-18 18:25:18 +01:00
|
|
|
|
|
|
|
@@unique([name, type, ownerId])
|
|
|
|
}
|
|
|
|
|
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())
|
2022-02-22 10:16:35 +01:00
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2021-12-06 15:48:50 +01:00
|
|
|
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[]
|
2022-02-21 06:57:44 +01:00
|
|
|
|
2022-02-18 18:18:38 +01:00
|
|
|
@@unique([id, ownerId])
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Typebot {
|
2022-02-24 11:13:19 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2022-04-01 16:28:09 +02:00
|
|
|
icon String?
|
2021-12-06 15:48:50 +01:00
|
|
|
name String
|
|
|
|
ownerId String
|
2022-02-24 11:13:19 +01:00
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
2021-12-06 15:48:50 +01:00
|
|
|
publishedTypebotId String?
|
|
|
|
publishedTypebot PublicTypebot?
|
|
|
|
results Result[]
|
|
|
|
folderId String?
|
2022-02-24 11:13:19 +01:00
|
|
|
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
2022-02-04 19:00:08 +01:00
|
|
|
blocks Json[]
|
|
|
|
variables Json[]
|
|
|
|
edges Json[]
|
2021-12-23 09:37:42 +01:00
|
|
|
theme Json
|
2021-12-23 13:49:24 +01:00
|
|
|
settings Json
|
2022-02-24 11:13:19 +01:00
|
|
|
publicId String? @unique
|
|
|
|
customDomain String? @unique
|
|
|
|
collaborators CollaboratorsOnTypebots[]
|
|
|
|
invitations Invitation[]
|
2022-03-01 11:40:22 +01:00
|
|
|
webhooks Webhook[]
|
2022-02-21 06:57:44 +01:00
|
|
|
|
2022-02-18 18:18:38 +01:00
|
|
|
@@unique([id, ownerId])
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
|
|
|
|
2022-02-24 11:13:19 +01:00
|
|
|
model Invitation {
|
2022-02-24 14:52:35 +01:00
|
|
|
createdAt DateTime @default(now())
|
2022-02-24 11:13:19 +01:00
|
|
|
email String
|
|
|
|
typebotId String
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
|
|
type CollaborationType
|
|
|
|
|
|
|
|
@@unique([email, typebotId])
|
|
|
|
}
|
|
|
|
|
|
|
|
model CollaboratorsOnTypebots {
|
|
|
|
userId String
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
typebotId String
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
|
|
type CollaborationType
|
|
|
|
|
|
|
|
@@unique([userId, typebotId])
|
|
|
|
}
|
|
|
|
|
|
|
|
enum CollaborationType {
|
|
|
|
READ
|
|
|
|
WRITE
|
|
|
|
}
|
|
|
|
|
2021-12-06 15:48:50 +01:00
|
|
|
model PublicTypebot {
|
2022-02-22 10:16:35 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
typebotId String @unique
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
2022-02-18 14:57:10 +01:00
|
|
|
name String
|
|
|
|
blocks Json[]
|
|
|
|
variables Json[]
|
|
|
|
edges Json[]
|
|
|
|
theme Json
|
|
|
|
settings Json
|
2022-02-22 10:16:35 +01:00
|
|
|
publicId String? @unique
|
|
|
|
customDomain String? @unique
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Result {
|
2022-03-28 17:07:47 +02:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
typebotId String
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
|
|
answers Answer[]
|
|
|
|
variables Json[]
|
|
|
|
isCompleted Boolean
|
|
|
|
logs Log[]
|
2022-03-01 11:40:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Log {
|
2022-03-28 17:07:47 +02:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
2022-03-01 11:40:22 +01:00
|
|
|
resultId String
|
2022-03-28 17:07:47 +02:00
|
|
|
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
2022-03-01 11:40:22 +01:00
|
|
|
status String
|
|
|
|
description String
|
|
|
|
details String?
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
2021-12-30 10:24:16 +01:00
|
|
|
|
|
|
|
model Answer {
|
2022-02-17 16:08:01 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
resultId String
|
|
|
|
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
|
|
|
stepId String
|
|
|
|
blockId String
|
|
|
|
variableId String?
|
|
|
|
content String
|
2021-12-30 10:24:16 +01:00
|
|
|
|
|
|
|
@@unique([resultId, blockId, stepId])
|
|
|
|
}
|
2022-02-14 09:00:47 +01:00
|
|
|
|
|
|
|
model Coupon {
|
|
|
|
userPropertiesToUpdate Json
|
2022-02-18 18:18:38 +01:00
|
|
|
code String @id @unique
|
2022-02-14 09:00:47 +01:00
|
|
|
dateRedeemed DateTime?
|
|
|
|
}
|
2022-03-01 07:13:09 +01:00
|
|
|
|
|
|
|
model Webhook {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
url String?
|
|
|
|
method String
|
|
|
|
queryParams Json[]
|
|
|
|
headers Json[]
|
|
|
|
body String?
|
|
|
|
typebotId String
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
|
|
}
|