46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
// 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"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Article {
|
|
id String @id @default(cuid())
|
|
slug String @unique // URL-friendly title (e.g., "Albert_Einstein")
|
|
title String // Display title
|
|
content String @db.Text // Full markdown content
|
|
imageUrl String? // Main image URL
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
history ArticleHistory[]
|
|
|
|
@@index([slug])
|
|
}
|
|
|
|
model ArticleHistory {
|
|
id String @id @default(cuid())
|
|
articleId String
|
|
article Article @relation(fields: [articleId], references: [id], onDelete: Cascade)
|
|
oldContent String @db.Text
|
|
newContent String @db.Text
|
|
reason String // AI reason or "Initial article"
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([articleId])
|
|
@@index([createdAt])
|
|
}
|
|
|
|
model Search {
|
|
id String @id @default(cuid())
|
|
query String
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([createdAt])
|
|
}
|