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.5 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       @default(uuid()) // not unique!
  projectId   String
  format      String
  size        Int
  name        String
  description String?
  location    Location
  createdAt   DateTime     @default(now())
  meta        String       @default("{}")
  status      UploadStatus @default(UPLOADED)

  @@id([id, projectId])
}

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())
  createdAt DateTime @default(now())
  title     String
  domain    String   @unique
  user      User?    @relation(fields: [userId], references: [id])
  userId    String?
  build     Build[]
  trees     Tree[]
  isDeleted Boolean  @default(false)

  @@unique([id, isDeleted])
  @@unique([domain, isDeleted])
}

model Build {
  id        String   @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           String @default("[]")
  styles                String @default("[]")
  styleSources          String @default("[]")
  styleSourceSelections String @default("[]")
  props                 String @default("[]")
  instances             String @default("[]")

  @@id([id, projectId])
}

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

  @@id([id, projectId])
}

model Breakpoints {
  buildId String @id
  values  String @default("[]")
}

enum AuthorizationRelation {
  viewers
  editors
  builders
}

model AuthorizationToken {
  token     String                @default(uuid())
  // No relation to Project, as the Authorization system is not tied to a project
  projectId String
  name      String                @default("")
  relation  AuthorizationRelation @default(viewers)
  createdAt DateTime              @default(now())

  @@id([token, projectId])
}

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