mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-16 23:53:36 -05:00
* add tag functionality to responses --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
170 lines
5.1 KiB
Plaintext
170 lines
5.1 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
//provider = "prisma-dbml-generator"
|
|
}
|
|
|
|
enum PipelineType {
|
|
webhook
|
|
emailNotification
|
|
slackNotification
|
|
}
|
|
|
|
enum PipelineEvent {
|
|
submissionCreated
|
|
submissionUpdated
|
|
submissionFinished
|
|
}
|
|
|
|
model Pipeline {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
label String
|
|
type PipelineType
|
|
events PipelineEvent[]
|
|
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
|
formId String
|
|
enabled Boolean @default(true)
|
|
config Json @default("{}")
|
|
}
|
|
|
|
model Customer {
|
|
email String
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
organisation Organisation @relation(fields: [organisationId], references: [id], onDelete: Cascade)
|
|
organisationId String
|
|
submissions Submission[]
|
|
data Json @default("{}")
|
|
|
|
@@id([email, organisationId])
|
|
}
|
|
|
|
enum FormType {
|
|
custom
|
|
feedback
|
|
pmf
|
|
}
|
|
|
|
model Form {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
type FormType
|
|
label String
|
|
organisation Organisation @relation(fields: [organisationId], references: [id], onDelete: Cascade)
|
|
organisationId String
|
|
schema Json @default("{}")
|
|
submissions Submission[]
|
|
pipelines Pipeline[]
|
|
}
|
|
|
|
model Submission {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
finished Boolean @default(false)
|
|
archived Boolean @default(false)
|
|
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
|
formId String
|
|
customer Customer? @relation(fields: [customerEmail, customerOrganisationId], references: [email, organisationId], onDelete: Cascade)
|
|
customerEmail String?
|
|
customerOrganisationId String?
|
|
data Json @default("{}")
|
|
meta Json @default("{}")
|
|
tags String[]
|
|
}
|
|
|
|
enum Plan {
|
|
free
|
|
pro
|
|
}
|
|
|
|
model Organisation {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
members Membership[]
|
|
forms Form[]
|
|
customers Customer[]
|
|
plan Plan @default(free)
|
|
stripeCustomerId String?
|
|
}
|
|
|
|
enum MembershipRole {
|
|
member
|
|
admin
|
|
owner
|
|
}
|
|
|
|
model Membership {
|
|
organisation Organisation @relation(fields: [organisationId], references: [id], onDelete: Cascade)
|
|
organisationId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId String
|
|
accepted Boolean @default(false)
|
|
role MembershipRole
|
|
|
|
@@id([userId, organisationId])
|
|
}
|
|
|
|
model ApiKey {
|
|
id String @id @unique @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
lastUsedAt DateTime?
|
|
label String?
|
|
hashedKey String @unique()
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId String
|
|
}
|
|
|
|
enum IdentityProvider {
|
|
email
|
|
github
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
access_token String? @db.Text
|
|
refresh_token String? @db.Text
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String? @db.Text
|
|
session_state String?
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String?
|
|
email String @unique
|
|
emailVerified DateTime? @map(name: "email_verified")
|
|
password String?
|
|
identityProvider IdentityProvider @default(email)
|
|
identityProviderAccountId String?
|
|
organisations Membership[]
|
|
accounts Account[]
|
|
apiKeys ApiKey[]
|
|
finishedOnboarding Boolean @default(false)
|
|
}
|