Files
user01 46bc36a1f5 Initial commit: 용산 공중케이블 주민 안전 협의회 홈페이지
- Next.js 16 App Router + TypeScript + Tailwind CSS 4
- Prisma/SQLite 기반 공지사항·자료실·관리자·문의/제보
- 네이버 블로그 RSS 최신 글 5개 노출
- OCI 운영 배포 스크립트 및 문서
2026-10-26 00:52:53 +09:00

94 lines
2.5 KiB
Plaintext

// 개발 환경에서는 SQLite를 사용합니다.
// 운영 환경에서 MySQL로 전환할 때는 provider와 DATABASE_URL만 변경하고
// `prisma migrate dev`로 마이그레이션을 다시 생성하세요.
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
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
}