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

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

model Article {
  id           String   @id @default(uuid())
  name         String   @unique
  title        String   @unique
  introduction String   @default("")
  imageId      String?
  image        Image?   @relation(fields: [imageId], references: [id])
  markdown     String
  contentTable Json?
  categoryId   String
  category     Category @relation(fields: [categoryId], references: [id])
  dateCreated  DateTime @default(now())
  dateUpdated  DateTime @default(now())
}

model Category {
  id          String    @id @default(uuid())
  name        String    @unique
  title       String    @unique
  color       String
  svgId       String
  svg         Svg       @relation(fields: [svgId], references: [id])
  Article     Article[]
  dateCreated DateTime  @default(now())
  dateUpdated DateTime  @default(now())
}

model Image {
  id          String    @id @default(uuid())
  name        String    @unique
  alt         String    @default("")
  url         String    @default("")
  width       Int
  height      Int
  dateCreated DateTime  @default(now())
  Article     Article[]
}

model Svg {
  id       String     @id @default(uuid())
  path     String     @default("")
  viewbox  String     @default("0 0 512 512")
  Category Category[]
}
