2022-08-08 08:21:36 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
2021-11-29 15:19:07 +01:00
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
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?
|
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])
|
|
|
|
}
|
|
|
|
|
|
|
|
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?
|
2022-03-28 17:07:47 +02:00
|
|
|
company String?
|
|
|
|
onboardingCategories String[]
|
2022-04-08 14:30:46 -05:00
|
|
|
graphNavigation GraphNavigation?
|
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 {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
token String @unique
|
|
|
|
name String
|
|
|
|
ownerId String
|
|
|
|
lastUsedAt DateTime @default(now())
|
|
|
|
createdAt DateTime @default(now())
|
2022-08-08 08:21:36 +02:00
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
2022-06-03 13:20:19 +02:00
|
|
|
}
|
|
|
|
|
2022-05-13 15:22:44 -07:00
|
|
|
model Workspace {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String
|
|
|
|
icon String?
|
|
|
|
createdAt DateTime @default(now())
|
2022-06-03 13:20:19 +02:00
|
|
|
plan Plan @default(FREE)
|
2022-05-13 15:22:44 -07:00
|
|
|
stripeId String? @unique
|
|
|
|
credentials Credentials[]
|
2022-08-08 08:21:36 +02:00
|
|
|
customDomains CustomDomain[]
|
|
|
|
folders DashboardFolder[]
|
|
|
|
members MemberInWorkspace[]
|
|
|
|
typebots Typebot[]
|
2022-05-13 15:22:44 -07:00
|
|
|
invitations WorkspaceInvitation[]
|
2022-09-17 16:37:33 +02:00
|
|
|
additionalChatsIndex Int @default(0)
|
|
|
|
additionalStorageIndex Int @default(0)
|
|
|
|
chatsLimitFirstEmailSentAt DateTime?
|
|
|
|
storageLimitFirstEmailSentAt DateTime?
|
|
|
|
chatsLimitSecondEmailSentAt DateTime?
|
|
|
|
storageLimitSecondEmailSentAt DateTime?
|
2022-05-13 15:22:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
model MemberInWorkspace {
|
|
|
|
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])
|
|
|
|
}
|
|
|
|
|
|
|
|
model WorkspaceInvitation {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
email String
|
|
|
|
workspaceId String
|
|
|
|
type WorkspaceRole
|
2022-08-08 08:21:36 +02:00
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
2022-02-18 14:57:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model CustomDomain {
|
2022-06-21 16:53:45 +02:00
|
|
|
name String @id
|
|
|
|
createdAt DateTime @default(now())
|
2022-06-07 08:49:12 +02:00
|
|
|
workspaceId String
|
|
|
|
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
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
|
2022-08-08 08:21:36 +02:00
|
|
|
data String
|
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)
|
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
|
|
|
|
parentFolderId String?
|
2022-08-08 08:21:36 +02:00
|
|
|
workspaceId String
|
2021-12-06 15:48:50 +01:00
|
|
|
parentFolder DashboardFolder? @relation("ParentChild", fields: [parentFolderId], references: [id])
|
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[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Typebot {
|
2022-07-01 17:08:35 +02:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
icon String?
|
|
|
|
name String
|
|
|
|
publishedTypebotId String?
|
|
|
|
folderId String?
|
|
|
|
groups Json
|
|
|
|
variables Json[]
|
|
|
|
edges Json
|
|
|
|
theme Json
|
|
|
|
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[]
|
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
|
|
|
|
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])
|
|
|
|
}
|
|
|
|
|
|
|
|
model CollaboratorsOnTypebots {
|
|
|
|
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])
|
|
|
|
}
|
|
|
|
|
2021-12-06 15:48:50 +01:00
|
|
|
model PublicTypebot {
|
2022-06-21 16:53:45 +02:00
|
|
|
id String @id @default(cuid())
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
typebotId String @unique
|
|
|
|
groups Json
|
|
|
|
variables Json[]
|
|
|
|
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())
|
|
|
|
updatedAt DateTime @default(now()) @updatedAt
|
|
|
|
typebotId String
|
|
|
|
variables Json[]
|
|
|
|
isCompleted Boolean
|
2022-06-21 16:53:45 +02:00
|
|
|
hasStarted Boolean?
|
2022-06-24 14:06:06 +02:00
|
|
|
isArchived Boolean?
|
2022-09-25 20:16:08 +02:00
|
|
|
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: NoAction)
|
2022-08-08 08:21:36 +02:00
|
|
|
answers Answer[]
|
2022-03-28 17:07:47 +02:00
|
|
|
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
|
|
|
|
status String
|
|
|
|
description String
|
|
|
|
details String?
|
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 {
|
2022-07-01 17:08:35 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
resultId String
|
|
|
|
blockId String
|
|
|
|
groupId String
|
|
|
|
variableId String?
|
|
|
|
content String
|
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])
|
2022-06-24 11:12:01 +02:00
|
|
|
@@index([resultId])
|
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 {
|
|
|
|
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)
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
enum CollaborationType {
|
|
|
|
READ
|
|
|
|
WRITE
|
|
|
|
FULL_ACCESS
|
|
|
|
}
|