PostgreSQL 데이터 계층 추가

This commit is contained in:
2026-04-29 15:22:54 +09:00
parent cbf5ed6c8c
commit 5ee6fcd54b
20 changed files with 429 additions and 34 deletions

View File

@@ -99,6 +99,7 @@ components/content/
### 환경 분리 원칙
- 데이터베이스는 PostgreSQL을 기준으로 한다.
- 로컬 개발 환경과 NAS 운영 환경은 서로 다른 DB를 사용
- 로컬 개발 서버는 개발 DB만 연결
- NAS 배포 환경은 운영 DB만 연결
@@ -114,7 +115,7 @@ components/content/
| slug | String | URL 슬러그 |
| content | Text | 마크다운 콘텐츠 |
| excerpt | String | 요약 |
| featured_image | String | 대표 이미지 |
| featured_image | String nullable | 대표 이미지 |
| status | Enum | published/draft/private |
| published_at | DateTime | 발행일 |
| created_at | DateTime | 생성일 |
@@ -128,7 +129,7 @@ components/content/
| title | String | 제목 |
| slug | String | URL 슬러그 |
| content | Text | 마크다운 콘텐츠 |
| featured_image | String | 대표 이미지 |
| featured_image | String nullable | 대표 이미지 |
| created_at | DateTime | 생성일 |
| updated_at | DateTime | 수정일 |
@@ -140,6 +141,8 @@ components/content/
| name | String | 태그명 |
| slug | String | URL 슬러그 |
| description | String | 설명 |
| created_at | DateTime | 생성일 |
| updated_at | DateTime | 수정일 |
### PostTags (다대다)
@@ -147,6 +150,7 @@ components/content/
|------|------|------|
| post_id | UUID | FK → Posts |
| tag_id | UUID | FK → Tags |
| created_at | DateTime | 생성일 |
---
@@ -159,6 +163,8 @@ components/content/
- 별도 `backend/` 앱을 두지 않고 Nuxt/Nitro 서버 기능을 사용
- 공개 API는 `server/api`에 작성
- 서버 공통 스키마와 샘플 데이터는 `server/utils`에 작성
- PostgreSQL 연결과 조회 로직은 `server/repositories`에 작성
- `DATABASE_URL`이 없으면 샘플 데이터 저장소를 사용
- 초기 단계에서는 같은 앱 배포로 관리 비용을 낮춤
- 독립 API 서버가 필요해지는 시점에만 백엔드 분리를 재검토
@@ -203,8 +209,12 @@ components/content/
```env
# Database
DATABASE_URL=
DATABASE_NAME=
DATABASE_URL=postgres://sori_studio:change-this-password@sori-studio-db:5432/sori_studio
DATABASE_NAME=sori_studio
POSTGRES_DB=sori_studio
POSTGRES_USER=sori_studio
POSTGRES_PASSWORD=change-this-password
DB_PORT=43119
# Auth
ADMIN_EMAIL=
@@ -237,11 +247,12 @@ APP_PORT=43118
| 로컬 개발 서버 | 43117 |
| NAS Docker 외부 포트 | 43118 |
| 컨테이너 내부 포트 | 3000 |
| PostgreSQL 외부 포트 | 43119 |
---
## 버전 관리
- 현재 버전: v0.0.4
- 현재 버전: v0.0.5
- 첫 커밋 이후 변경사항을 커밋할 때마다 패치 버전 증가
- 메이저/마이너 버전은 구조 변경 또는 기능 묶음 단위로 결정