sunnymh/manga-site/prisma/schema.prisma

50 lines
1.0 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Manga {
id Int @id @default(autoincrement())
title String
description String
coverUrl String
slug String @unique
genre String @default("Drama")
status Status @default(PUBLISHED)
chapters Chapter[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Chapter {
id Int @id @default(autoincrement())
mangaId Int
number Int
title String
pages Page[]
manga Manga @relation(fields: [mangaId], references: [id])
@@unique([mangaId, number])
}
model Page {
id Int @id @default(autoincrement())
chapterId Int
number Int
imageUrl String
width Int @default(0)
height Int @default(0)
chapter Chapter @relation(fields: [chapterId], references: [id])
@@unique([chapterId, number])
}
enum Status {
PUBLISHED
DRAFT
}