2022-08-08 08:21:36 +02:00
|
|
|
generator client {
|
2023-07-16 18:52:30 +02:00
|
|
|
provider = "prisma-client-js"
|
2022-08-08 08:21:36 +02:00
|
|
|
}
|
|
|
|
|
2021-11-29 15:19:07 +01:00
|
|
|
datasource db {
|
2023-02-08 10:51:32 +01:00
|
|
|
provider = "mysql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
relationMode = "prisma"
|
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
|
2023-02-08 10:51:32 +01:00
|
|
|
refresh_token String? @db.Text
|
|
|
|
access_token String? @db.Text
|
2021-12-06 15:48:50 +01:00
|
|
|
expires_at Int?
|
|
|
|
token_type String?
|
|
|
|
scope String?
|
2023-02-08 10:51:32 +01:00
|
|
|
id_token String? @db.Text
|
2021-12-06 15:48:50 +01:00
|
|
|
session_state String?
|
|
|
|
oauth_token_secret String?
|
|
|
|
oauth_token String?
|
2021-11-29 15:19:07 +01:00
|
|
|
refresh_token_expires_in Int?
|
2022-08-08 08:21:36 +02:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2021-11-29 15:19:07 +01:00
|
|
|
|
|
|
|
@@unique([provider, providerAccountId])
|
2023-02-08 10:51:32 +01:00
|
|
|
@@index([userId])
|
2021-11-29 15:19:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
sessionToken String @unique
|
|
|
|
userId String
|
|
|
|
expires DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([userId])
|
2021-11-29 15:19:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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())
|
2023-02-08 10:51:32 +01:00
|
|
|
name String? @db.VarChar(255)
|
2022-02-24 11:13:19 +01:00
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime?
|
2023-02-08 10:51:32 +01:00
|
|
|
image String? @db.VarChar(1000)
|
2022-03-28 17:07:47 +02:00
|
|
|
company String?
|
2023-02-01 09:32:39 +01:00
|
|
|
onboardingCategories Json
|
2022-04-08 14:30:46 -05:00
|
|
|
graphNavigation GraphNavigation?
|
2023-02-01 09:32:39 +01:00
|
|
|
preferredAppAppearance String?
|
2022-08-08 08:21:36 +02:00
|
|
|
accounts Account[]
|
|
|
|
apiTokens ApiToken[]
|
|
|
|
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
2022-05-13 15:22:44 -07:00
|
|
|
workspaces MemberInWorkspace[]
|
2022-08-08 08:21:36 +02:00
|
|
|
sessions Session[]
|
2022-05-13 15:22:44 -07:00
|
|
|
}
|
|
|
|
|
2022-06-03 13:20:19 +02:00
|
|
|
model ApiToken {
|
2023-02-03 07:58:14 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
token String @unique
|
|
|
|
name String
|
|
|
|
ownerId String
|
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([ownerId])
|
2022-06-03 13:20:19 +02:00
|
|
|
}
|
|
|
|
|
2022-05-13 15:22:44 -07:00
|
|
|
model Workspace {
|
2022-10-01 08:36:49 +02:00
|
|
|
id String @id @default(cuid())
|
2023-02-03 07:58:14 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2023-02-08 10:51:32 +01:00
|
|
|
name String @db.VarChar(255)
|
|
|
|
icon String? @db.VarChar(1000)
|
2022-10-01 08:36:49 +02:00
|
|
|
plan Plan @default(FREE)
|
|
|
|
stripeId String? @unique
|
|
|
|
credentials Credentials[]
|
|
|
|
customDomains CustomDomain[]
|
|
|
|
folders DashboardFolder[]
|
|
|
|
members MemberInWorkspace[]
|
|
|
|
typebots Typebot[]
|
|
|
|
invitations WorkspaceInvitation[]
|
|
|
|
additionalChatsIndex Int @default(0)
|
|
|
|
additionalStorageIndex Int @default(0)
|
|
|
|
chatsLimitFirstEmailSentAt DateTime?
|
|
|
|
storageLimitFirstEmailSentAt DateTime?
|
|
|
|
chatsLimitSecondEmailSentAt DateTime?
|
2022-09-17 16:37:33 +02:00
|
|
|
storageLimitSecondEmailSentAt DateTime?
|
2022-11-29 10:02:40 +01:00
|
|
|
claimableCustomPlan ClaimableCustomPlan?
|
2022-10-27 11:32:21 +02:00
|
|
|
customChatsLimit Int?
|
|
|
|
customStorageLimit Int?
|
|
|
|
customSeatsLimit Int?
|
2023-04-23 20:57:51 +02:00
|
|
|
isQuarantined Boolean @default(false)
|
2023-07-04 14:56:36 +02:00
|
|
|
isSuspended Boolean @default(false)
|
2023-03-28 15:10:06 +02:00
|
|
|
themeTemplates ThemeTemplate[]
|
2022-05-13 15:22:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
model MemberInWorkspace {
|
2023-02-03 07:58:14 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2022-05-13 15:22:44 -07:00
|
|
|
userId String
|
|
|
|
workspaceId String
|
|
|
|
role WorkspaceRole
|
2022-08-08 08:21:36 +02:00
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2022-05-13 15:22:44 -07:00
|
|
|
|
|
|
|
@@unique([userId, workspaceId])
|
2023-02-08 10:51:32 +01:00
|
|
|
@@index([workspaceId])
|
2022-05-13 15:22:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
model WorkspaceInvitation {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
2023-02-03 07:58:14 +01:00
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2022-05-13 15:22:44 -07:00
|
|
|
email String
|
|
|
|
workspaceId String
|
|
|
|
type WorkspaceRole
|
2022-08-08 08:21:36 +02:00
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([workspaceId])
|
2022-02-18 14:57:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model CustomDomain {
|
2023-02-08 10:51:32 +01:00
|
|
|
name String @id @db.VarChar(255)
|
2022-06-21 16:53:45 +02:00
|
|
|
createdAt DateTime @default(now())
|
2022-06-07 08:49:12 +02:00
|
|
|
workspaceId String
|
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([workspaceId])
|
2022-01-18 18:25:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Credentials {
|
2022-06-21 16:53:45 +02:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
2022-06-07 08:49:12 +02:00
|
|
|
workspaceId String
|
2023-02-13 17:42:11 +01:00
|
|
|
data String @db.Text
|
2022-05-13 15:22:44 -07:00
|
|
|
name String
|
|
|
|
type String
|
|
|
|
iv String
|
2022-08-08 08:21:36 +02:00
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([workspaceId])
|
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
|
2023-02-08 10:51:32 +01:00
|
|
|
name String @db.VarChar(255)
|
2021-12-06 15:48:50 +01:00
|
|
|
parentFolderId String?
|
2022-08-08 08:21:36 +02:00
|
|
|
workspaceId String
|
2023-02-08 10:51:32 +01:00
|
|
|
parentFolder DashboardFolder? @relation("ParentChild", fields: [parentFolderId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
2022-08-08 08:21:36 +02:00
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2021-12-06 15:48:50 +01:00
|
|
|
childrenFolder DashboardFolder[] @relation("ParentChild")
|
|
|
|
typebots Typebot[]
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([workspaceId])
|
|
|
|
@@index([parentFolderId])
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model Typebot {
|
2022-07-01 17:08:35 +02:00
|
|
|
id String @id @default(cuid())
|
2023-02-21 15:25:14 +01:00
|
|
|
version String? @db.VarChar(10)
|
2022-07-01 17:08:35 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2023-06-20 14:17:53 +02:00
|
|
|
icon String? @db.Text()
|
2023-02-08 10:51:32 +01:00
|
|
|
name String @db.VarChar(255)
|
2022-07-01 17:08:35 +02:00
|
|
|
folderId String?
|
|
|
|
groups Json
|
2023-02-01 09:32:39 +01:00
|
|
|
variables Json
|
2022-07-01 17:08:35 +02:00
|
|
|
edges Json
|
|
|
|
theme Json
|
2023-03-28 15:10:06 +02:00
|
|
|
selectedThemeTemplateId String?
|
2022-07-01 17:08:35 +02:00
|
|
|
settings Json
|
|
|
|
publicId String? @unique
|
|
|
|
customDomain String? @unique
|
2022-08-08 08:21:36 +02:00
|
|
|
workspaceId String
|
|
|
|
resultsTablePreferences Json?
|
|
|
|
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2022-07-01 17:08:35 +02:00
|
|
|
collaborators CollaboratorsOnTypebots[]
|
|
|
|
invitations Invitation[]
|
2022-08-08 08:21:36 +02:00
|
|
|
publishedTypebot PublicTypebot?
|
|
|
|
results Result[]
|
2022-07-01 17:08:35 +02:00
|
|
|
webhooks Webhook[]
|
2022-10-06 08:33:46 +02:00
|
|
|
isArchived Boolean @default(false)
|
|
|
|
isClosed Boolean @default(false)
|
2023-08-29 10:01:28 +02:00
|
|
|
whatsAppPhoneNumberId String?
|
2023-09-22 11:08:41 +02:00
|
|
|
whatsAppCredentialsId String?
|
2022-12-06 19:11:11 +01:00
|
|
|
|
|
|
|
@@index([workspaceId])
|
2023-02-08 10:51:32 +01:00
|
|
|
@@index([folderId])
|
2023-02-11 19:04:54 +01:00
|
|
|
@@index([isArchived, createdAt(sort: Desc)])
|
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())
|
2023-02-03 07:58:14 +01:00
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2022-02-24 11:13:19 +01:00
|
|
|
email String
|
|
|
|
typebotId String
|
|
|
|
type CollaborationType
|
2022-08-08 08:21:36 +02:00
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
2022-02-24 11:13:19 +01:00
|
|
|
|
|
|
|
@@unique([email, typebotId])
|
2023-02-08 10:51:32 +01:00
|
|
|
@@index([typebotId])
|
2022-02-24 11:13:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model CollaboratorsOnTypebots {
|
2023-02-03 07:58:14 +01:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2022-02-24 11:13:19 +01:00
|
|
|
userId String
|
|
|
|
typebotId String
|
|
|
|
type CollaborationType
|
2022-08-08 08:21:36 +02:00
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
2022-02-24 11:13:19 +01:00
|
|
|
|
|
|
|
@@unique([userId, typebotId])
|
2023-02-08 10:51:32 +01:00
|
|
|
@@index([typebotId])
|
2022-02-24 11:13:19 +01:00
|
|
|
}
|
|
|
|
|
2021-12-06 15:48:50 +01:00
|
|
|
model PublicTypebot {
|
2022-06-21 16:53:45 +02:00
|
|
|
id String @id @default(cuid())
|
2023-02-21 15:25:14 +01:00
|
|
|
version String? @db.VarChar(10)
|
2022-06-21 16:53:45 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
typebotId String @unique
|
|
|
|
groups Json
|
2023-02-01 09:32:39 +01:00
|
|
|
variables Json
|
2022-06-21 16:53:45 +02:00
|
|
|
edges Json
|
|
|
|
theme Json
|
|
|
|
settings Json
|
2022-08-08 08:21:36 +02:00
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
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())
|
|
|
|
typebotId String
|
2023-02-01 09:32:39 +01:00
|
|
|
variables Json
|
2022-03-28 17:07:47 +02:00
|
|
|
isCompleted Boolean
|
2022-06-21 16:53:45 +02:00
|
|
|
hasStarted Boolean?
|
2022-10-01 08:36:49 +02:00
|
|
|
isArchived Boolean? @default(false)
|
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
2022-08-08 08:21:36 +02:00
|
|
|
answers Answer[]
|
2022-03-28 17:07:47 +02:00
|
|
|
logs Log[]
|
2022-10-20 08:20:43 +02:00
|
|
|
|
2023-02-13 14:28:44 +01:00
|
|
|
@@index([typebotId, isArchived, hasStarted, createdAt(sort: Desc)])
|
|
|
|
@@index([typebotId, isArchived, isCompleted])
|
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
|
|
|
|
status String
|
2023-02-08 10:51:32 +01:00
|
|
|
description String @db.Text
|
|
|
|
details String? @db.Text
|
2022-08-08 08:21:36 +02:00
|
|
|
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
2022-06-24 11:12:01 +02:00
|
|
|
|
|
|
|
@@index([resultId])
|
2021-12-06 15:48:50 +01:00
|
|
|
}
|
2021-12-30 10:24:16 +01:00
|
|
|
|
|
|
|
model Answer {
|
2023-02-03 07:58:14 +01:00
|
|
|
createdAt DateTime @default(now()) @updatedAt
|
2022-07-01 17:08:35 +02:00
|
|
|
resultId String
|
|
|
|
blockId String
|
2023-06-30 12:13:17 +02:00
|
|
|
itemId String?
|
2022-07-01 17:08:35 +02:00
|
|
|
groupId String
|
|
|
|
variableId String?
|
2023-02-11 19:04:54 +01:00
|
|
|
content String @db.Text
|
2022-06-21 16:53:45 +02:00
|
|
|
storageUsed Int?
|
2022-08-08 08:21:36 +02:00
|
|
|
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
2021-12-30 10:24:16 +01:00
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
@@unique([resultId, blockId, groupId])
|
2023-06-30 12:13:17 +02:00
|
|
|
@@index([blockId, itemId])
|
2023-02-11 19:04:54 +01:00
|
|
|
@@index([storageUsed])
|
2021-12-30 10:24:16 +01:00
|
|
|
}
|
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 {
|
2023-02-03 07:49:12 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
2023-02-08 10:51:32 +01:00
|
|
|
url String? @db.VarChar(2000)
|
2022-03-01 07:13:09 +01:00
|
|
|
method String
|
2023-02-01 09:32:39 +01:00
|
|
|
queryParams Json
|
|
|
|
headers Json
|
2023-02-08 10:51:32 +01:00
|
|
|
body String? @db.Text
|
2022-03-01 07:13:09 +01:00
|
|
|
typebotId String
|
2023-02-03 07:49:12 +01:00
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
2023-02-08 10:51:32 +01:00
|
|
|
|
|
|
|
@@index([typebotId])
|
2022-03-01 07:13:09 +01:00
|
|
|
}
|
2022-08-08 08:21:36 +02:00
|
|
|
|
2022-10-27 11:32:21 +02:00
|
|
|
model ClaimableCustomPlan {
|
2022-11-29 10:02:40 +01:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
2022-10-27 11:32:21 +02:00
|
|
|
claimedAt DateTime?
|
|
|
|
name String
|
|
|
|
description String?
|
|
|
|
price Int
|
|
|
|
currency String
|
2022-11-29 10:02:40 +01:00
|
|
|
workspaceId String @unique
|
2022-10-27 11:32:21 +02:00
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
|
|
|
chatsLimit Int
|
|
|
|
storageLimit Int
|
|
|
|
seatsLimit Int
|
2023-04-28 10:55:15 +02:00
|
|
|
isYearly Boolean @default(false)
|
|
|
|
companyName String?
|
|
|
|
vatType String?
|
|
|
|
vatValue String?
|
2022-10-27 11:32:21 +02:00
|
|
|
}
|
|
|
|
|
2022-11-29 10:02:40 +01:00
|
|
|
model ChatSession {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
state Json
|
|
|
|
}
|
|
|
|
|
2023-03-28 15:10:06 +02:00
|
|
|
model ThemeTemplate {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
name String
|
|
|
|
theme Json
|
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
|
|
|
workspaceId String
|
|
|
|
|
|
|
|
@@index([workspaceId])
|
|
|
|
}
|
|
|
|
|
2022-08-08 08:21:36 +02:00
|
|
|
enum WorkspaceRole {
|
|
|
|
ADMIN
|
|
|
|
MEMBER
|
|
|
|
GUEST
|
|
|
|
}
|
|
|
|
|
|
|
|
enum GraphNavigation {
|
|
|
|
MOUSE
|
|
|
|
TRACKPAD
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Plan {
|
|
|
|
FREE
|
2022-09-17 16:37:33 +02:00
|
|
|
STARTER
|
2022-08-08 08:21:36 +02:00
|
|
|
PRO
|
|
|
|
LIFETIME
|
|
|
|
OFFERED
|
2022-10-27 11:32:21 +02:00
|
|
|
CUSTOM
|
2023-01-27 15:00:07 +01:00
|
|
|
UNLIMITED
|
2022-08-08 08:21:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
enum CollaborationType {
|
|
|
|
READ
|
|
|
|
WRITE
|
|
|
|
FULL_ACCESS
|
|
|
|
}
|