// 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" } datasource db { provider = "postgresql" } model Book { id Int @id @default(autoincrement()) title String @db.VarChar(500) author String? @db.VarChar(500) totalPages Int coverUrl String? @db.VarChar(1000) deadlineDate DateTime @db.Date isPrimary Boolean @default(false) status String @default("reading") @db.VarChar(50) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt readingLogs ReadingLog[] @@index([deadlineDate]) @@index([status]) } model ReadingLog { id Int @id @default(autoincrement()) bookId Int logDate DateTime @db.Date currentPage Int createdAt DateTime @default(now()) updatedAt DateTime @updatedAt book Book @relation(fields: [bookId], references: [id], onDelete: Cascade) @@unique([bookId, logDate]) @@index([bookId]) @@index([logDate]) }