Files
ysochweb_node/prisma/schema.prisma
T
user01andClaude Opus 5.5 215bdb6fca Prisma 7 + better-sqlite3 드라이버 어댑터로 전환
- @prisma/client·prisma 6.19.3 → 7.10.1, @prisma/adapter-better-sqlite3 사용
- 생성 클라이언트를 src/generated/prisma 로 출력하고 저장소에 포함 (build 에서 prisma generate 제거)
- datasource URL 은 prisma.config.ts 에서 읽음
- db-url.ts: 상대 file: 경로를 Prisma CLI 와 같이 prisma/ 기준으로 해석
- DateTime 호환을 위해 timestampFormat: unixepoch-ms 지정
- Prisma 7 WASM 쿼리 컴파일러가 필요하므로 standalone 추적 제외 목록에서 wasm 제거
- README: 운영 서버에서 관리자 비밀번호 변경 절차 보강

현재 운영 서버(/srv/yonggong/build)에 배포된 소스와 동일합니다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 18:46:38 +09:00

94 lines
2.5 KiB
Plaintext

// 개발 환경에서는 SQLite를 사용합니다.
// 운영 환경에서 MySQL로 전환할 때는 provider와 DATABASE_URL만 변경하고
// `prisma migrate dev`로 마이그레이션을 다시 생성하세요.
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "sqlite"
}
model AdminUser {
id String @id @default(cuid())
loginId String @unique
passwordHash String
name String
role String @default("ADMIN") // ADMIN | EDITOR
totpSecret String?
lastLoginAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
posts Post[]
auditLogs AuditLog[]
}
model Post {
id Int @id @default(autoincrement())
type String // NOTICE | ARCHIVE
category String?
title String
content String
isPinned Boolean @default(false)
status String @default("PUBLISHED") // DRAFT | PUBLISHED
viewCount Int @default(0)
authorId String?
author AdminUser? @relation(fields: [authorId], references: [id], onDelete: SetNull)
publishedAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
attachments Attachment[]
@@index([type, status, publishedAt])
@@index([type, category])
}
model Attachment {
id Int @id @default(autoincrement())
postId Int?
post Post? @relation(fields: [postId], references: [id], onDelete: Cascade)
originalName String
storageKey String @unique
mimeType String
size Int
downloadCount Int @default(0)
createdAt DateTime @default(now())
@@index([postId])
}
model Inquiry {
id Int @id @default(autoincrement())
name String
email String
phone String?
title String
content String
consent Boolean @default(false)
status String @default("NEW") // NEW | IN_PROGRESS | DONE
ip String?
createdAt DateTime @default(now())
@@index([status, createdAt])
}
model AuditLog {
id Int @id @default(autoincrement())
adminId String?
admin AdminUser? @relation(fields: [adminId], references: [id], onDelete: SetNull)
action String
targetType String?
targetId String?
ip String?
createdAt DateTime @default(now())
@@index([createdAt])
}
model Setting {
key String @id
value String
updatedAt DateTime @updatedAt
}