Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

3.1 KB
Raw Blame
// DO NOT EDIT THIS FILE!
// This is a copy of your schema.prisma that corresponds to the state of the database 
// when all migrations up until this one are applied.
// It's used to generate a Prisma Client for the migration.

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["views", "clientExtensions"]
  output = "client"
}

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

model Team {
  id    String @id @default(uuid())
  users User[]
}

enum Location {
  FS
  REMOTE
}

enum UploadStatus {
  UPLOADING
  UPLOADED
}

model Asset {
  id          String       @id @default(uuid())
  projectId   String
  format      String
  size        Int
  name        String
  description String?
  location    Location
  createdAt   DateTime     @default(now())
  meta        String       @default("{}")
  status      UploadStatus @default(UPLOADED)
}

model User {
  id        String    @id @default(uuid())
  email     String?   @unique
  provider  String?
  image     String?
  username  String?
  createdAt DateTime  @default(now())
  team      Team?     @relation(fields: [teamId], references: [id])
  teamId    String?
  projects  Project[]
}

model Project {
  id        String  @id @default(uuid())
  title     String
  domain    String  @unique
  user      User?   @relation(fields: [userId], references: [id])
  userId    String?
  build     Build[]
  trees     Tree[]
  isDeleted Boolean @default(false)
}

model Build {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  pages     String

  project   Project @relation(fields: [projectId], references: [id])
  projectId String
  trees     Tree[]

  isDev  Boolean // exctly one is true per project
  isProd Boolean // at most one is true per project (none if not published)

  breakpoints Breakpoints?

  styles       String @default("[]")
  styleSources String @default("[]")
}

model Tree {
  id              String @id @default(uuid())
  project         Project? @relation(fields: [projectId], references: [id])
  projectId       String?
  build           Build? @relation(fields: [buildId], references: [id])
  buildId         String?
  root            String
  instances       String @default("[]")
  props           String @default("[]")
  styles          String @default("[]")
  styleSelections String @default("[]")
}

model Breakpoints {
  build   Build  @relation(fields: [buildId], references: [id])
  buildId String @id
  values  String @default("[]")
}

enum AuthorizationPermit {
  VIEW
  EDIT
}

model AuthorizationTokens {
  id        String              @id @default(uuid())
  // No relation to Project, as the Authorization system is not tied to a project
  projectId String
  token     String
  permit    AuthorizationPermit
  createdAt DateTime            @default(now())
}

// Dashboard
view DashboardProject {
  id          String  @id @default(uuid())
  title       String
  domain      String
  userId      String?
  isDeleted   Boolean @default(false)
  isPublished Boolean
}