Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions static/06_데이터모델_및_무결성.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ deleted_at TIMESTAMPTZ NULL

- 소유자는 `member_id` 하나입니다. `shelf_id`를 두지 않습니다.
- 활성 Collection에는 활성 CollectionRecord가 최소 한 개 있어야 합니다.
- `published_at`은 컬럼 자체로는 NULL을 허용하지만, **발행된 행(`is_published = true`)은 반드시 값을 가집니다**(§4.1 `CHECK`). MVP Collection은 생성 즉시 발행되므로 실질적으로 모든 행에 값이 있고, 기존 NULL 데이터는 `created_at`으로 백필합니다. 컬럼을 `NOT NULL`로 만들지 않는 이유는 `is_published`가 false일 수 있다는 전제 위에 이 컬럼이 존재하기 때문입니다.
- `is_published`는 MVP에서 항상 `true`로 생성되지만, 향후 공개·비공개 전환을 위해 데이터로 관리합니다(정책 7.2).
- `record_count`는 활성 연결 수의 비정규화 값입니다. 목록·피드에서 장소 개수(정책 8.1)를 N+1 없이 제공하기 위해 두며, 연결 추가·제거와 **동일 트랜잭션**에서 갱신합니다.

Expand Down Expand Up @@ -353,6 +354,7 @@ ALTER TABLE place ADD CONSTRAINT ck_place_lng CHECK (lng BETWEEN -180 AND 180);
| 동일 Shelf 중복 Follow 금지 | 활성행 부분 유니크 |
| 자기 Shelf Follow 금지 | `CHECK` |
| Collection 제목 20자 이하·공백만 금지 | 컬럼 길이 + `CHECK` |
| 발행된 Collection의 발행 시각 누락 금지 | `CHECK (NOT is_published OR published_at IS NOT NULL)` |
| Context 본문 공백만 금지 | `CHECK` |
| 좌표 범위 | `CHECK` |

Expand Down
2 changes: 1 addition & 1 deletion static/07_ERD.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ erDiagram
bigint member_id FK
varchar title "20자"
boolean is_published
timestamptz published_at
timestamptz published_at "발행 시 필수 (CHECK)"
int record_count "활성 연결 수 비정규화"
timestamptz created_at
timestamptz updated_at
Expand Down