Skip to main content

SnoopForms

The Open-Source Typeform Alternative

GitHub Repo

Schema

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

enum FormType {
CODE
NOCODE
}

enum PipelineType {
WEBHOOK
}

enum PipelineEvent {
PAGE_SUBMISSION
}

model Form {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
ownerId Int
formType FormType @default(NOCODE)
name String @default("")
schema Json @default("{}")
submissionSessions SubmissionSession[]
pipelines Pipeline[]
noCodeForm NoCodeForm?
}

model NoCodeForm {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
formId String @unique
blocks Json @default("[]")
blocksDraft Json @default("[]")
published Boolean @default(false)
closed Boolean @default(false)
}

model Pipeline {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
name String
type PipelineType
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
formId String
enabled Boolean @default(false)
events PipelineEvent[]
data Json @default("{}")
}

model SubmissionSession {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
form Form @relation(fields: [formId], references: [id], onDelete: Cascade)
formId String
events SessionEvent[]
}

model SessionEvent {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
submissionSession SubmissionSession @relation(fields: [submissionSessionId], references: [id], onDelete: Cascade)
submissionSessionId String
type String
data Json
}

model User {
id Int @id @default(autoincrement())
firstname String?
lastname String?
email String @unique
emailVerified DateTime? @map(name: "email_verified")
password String
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
forms Form[]

@@map(name: "users")
}