mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-17 23:56:49 -05:00
### New Formbricks Release: Complete Rewrite, New Features & Enhanced UI 🚀 We're thrilled to announce the release of the new Formbricks, a complete overhaul of our codebase, packed with powerful features and an improved user experience. #### What's New: 1. **Survey Builder**: Design and customize your in-product micro-surveys with our intuitive survey builder. 2. **Trigger Micro-Surveys**: Set up micro-surveys to appear at specific points within your app, allowing you to gather feedback when it matters most. 3. **JavaScript SDK**: Our new JavaScript SDK makes integration a breeze - just embed it once and you're ready to go. 4. **No-Code Events**: Set up events and triggers without writing a single line of code, making it accessible for everyone on your team. 5. **Revamped UI**: Enjoy an entirely new user interface that enhances usability and provides a smooth, delightful experience. This release marks a major step forward for Formbricks, enabling you to better understand your users and build an outstanding product experience. Please update your Formbricks integration to take advantage of these exciting new features, and let us know in the Discord if you have any questions or feedback! Happy surveying! 🎉
319 lines
9.9 KiB
Plaintext
319 lines
9.9 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"
|
|
previewFeatures = ["filteredRelationCount"]
|
|
//provider = "prisma-dbml-generator"
|
|
}
|
|
|
|
model Attribute {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
attributeClass AttributeClass @relation(fields: [attributeClassId], references: [id], onDelete: Cascade)
|
|
attributeClassId String
|
|
person Person @relation(fields: [personId], references: [id], onDelete: Cascade)
|
|
personId String
|
|
value String
|
|
|
|
@@unique([attributeClassId, personId])
|
|
}
|
|
|
|
enum AttributeType {
|
|
code
|
|
noCode
|
|
automatic
|
|
}
|
|
|
|
model AttributeClass {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
description String?
|
|
type AttributeType
|
|
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
|
environmentId String
|
|
attributes Attribute[]
|
|
|
|
@@unique([name, environmentId])
|
|
}
|
|
|
|
model Person {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
|
environmentId String
|
|
responses Response[]
|
|
sessions Session[]
|
|
attributes Attribute[]
|
|
displays Display[]
|
|
}
|
|
|
|
model Response {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
finished Boolean @default(false)
|
|
survey Survey @relation(fields: [surveyId], references: [id], onDelete: Cascade)
|
|
surveyId String
|
|
person Person @relation(fields: [personId], references: [id], onDelete: Cascade)
|
|
personId String
|
|
data Json @default("{}")
|
|
meta Json @default("{}")
|
|
userAttributes Json @default("[]")
|
|
tags String[]
|
|
}
|
|
|
|
enum SurveyStatus {
|
|
draft
|
|
inProgress
|
|
paused
|
|
completed
|
|
archived
|
|
}
|
|
|
|
enum DisplayStatus {
|
|
seen
|
|
responded
|
|
}
|
|
|
|
model Display {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
survey Survey @relation(fields: [surveyId], references: [id], onDelete: Cascade)
|
|
surveyId String
|
|
person Person @relation(fields: [personId], references: [id], onDelete: Cascade)
|
|
personId String
|
|
status DisplayStatus @default(seen)
|
|
}
|
|
|
|
model SurveyTrigger {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
survey Survey @relation(fields: [surveyId], references: [id], onDelete: Cascade)
|
|
surveyId String
|
|
eventClass EventClass @relation(fields: [eventClassId], references: [id], onDelete: Cascade)
|
|
eventClassId String
|
|
|
|
@@unique([surveyId, eventClassId])
|
|
}
|
|
|
|
enum SurveyType {
|
|
email
|
|
link
|
|
mobile
|
|
web
|
|
}
|
|
|
|
enum displayOptions {
|
|
displayOnce
|
|
displayMultiple
|
|
respondMultiple
|
|
}
|
|
|
|
model Survey {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
type String @default("web")
|
|
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
|
environmentId String
|
|
status SurveyStatus @default(draft)
|
|
questions Json @default("[]")
|
|
responses Response[]
|
|
displayOption displayOptions @default(displayOnce)
|
|
recontactDays Int?
|
|
triggers SurveyTrigger[]
|
|
displays Display[]
|
|
}
|
|
|
|
model Event {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
eventClass EventClass? @relation(fields: [eventClassId], references: [id])
|
|
eventClassId String?
|
|
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
|
sessionId String
|
|
properties Json @default("{}")
|
|
}
|
|
|
|
enum EventType {
|
|
code
|
|
noCode
|
|
automatic
|
|
}
|
|
|
|
model EventClass {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
description String?
|
|
type EventType
|
|
events Event[]
|
|
noCodeConfig Json?
|
|
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
|
environmentId String
|
|
surveys SurveyTrigger[]
|
|
|
|
@@unique([name, environmentId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
person Person @relation(fields: [personId], references: [id], onDelete: Cascade)
|
|
personId String
|
|
events Event[]
|
|
}
|
|
|
|
enum EnvironmentType {
|
|
production
|
|
development
|
|
}
|
|
|
|
model Environment {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
type EnvironmentType
|
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
|
productId String
|
|
widgetSetupCompleted Boolean @default(false)
|
|
surveys Survey[]
|
|
people Person[]
|
|
eventClasses EventClass[]
|
|
attributeClasses AttributeClass[]
|
|
}
|
|
|
|
model Product {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
|
teamId String
|
|
environments Environment[]
|
|
brandColor String @default("#334155")
|
|
recontactDays Int @default(7)
|
|
}
|
|
|
|
enum Plan {
|
|
free
|
|
pro
|
|
}
|
|
|
|
model Team {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
name String
|
|
memberships Membership[]
|
|
products Product[]
|
|
plan Plan @default(free)
|
|
stripeCustomerId String?
|
|
invites Invite[]
|
|
}
|
|
|
|
enum MembershipRole {
|
|
owner
|
|
admin
|
|
editor
|
|
developer
|
|
viewer
|
|
}
|
|
|
|
model Membership {
|
|
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
|
teamId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId String
|
|
accepted Boolean @default(false)
|
|
role MembershipRole
|
|
|
|
@@id([userId, teamId])
|
|
}
|
|
|
|
model Invite {
|
|
id String @id @default(uuid())
|
|
email String
|
|
name String?
|
|
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
|
teamId String
|
|
creator User @relation("inviteCreatedBy", fields: [creatorId], references: [id])
|
|
creatorId String
|
|
acceptor User? @relation("inviteAcceptedBy", fields: [acceptorId], references: [id], onDelete: Cascade)
|
|
acceptorId String?
|
|
accepted Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
expiresAt DateTime
|
|
role MembershipRole @default(admin)
|
|
|
|
@@index([email, teamId], name: "email_teamId_unique")
|
|
}
|
|
|
|
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?
|
|
memberships Membership[]
|
|
accounts Account[]
|
|
apiKeys ApiKey[]
|
|
groupId String?
|
|
invitesCreated Invite[] @relation("inviteCreatedBy")
|
|
invitesAccepted Invite[] @relation("inviteAcceptedBy")
|
|
}
|