schema.prisma 1.04 KB
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-1.1.x"]
}

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

model User {
  id          Int       @default(autoincrement()) @id
  avatarUrl   String?
  email       String    @unique
  password    String
  name        String
  phoneNumber String?   @unique
  emailSecret String?
  phoneSecret String?
  bio         String?
  rooms       Room[]    @relation(references: [id])
  messages    Message[]
  createdAt   DateTime? @default(now())
}

model Room {
  id           Int        @default(autoincrement()) @id
  participants User[]     @relation(references: [id])
  categories   Category[] @relation(references: [id])
}

model Category {
  id    Int     @default(autoincrement()) @id
  name  String? @default("")
  rooms Room[]  @relation(references: [id])
}

model Message {
  id       Int     @default(autoincrement()) @id
  text     String? @default("")
  sender   User    @relation(fields: [senderId], references: [id])
  senderId Int
}