SNS ERD
SNS ERD는 작성, 반응, 팔로우 관계를 분리한다
게시글 작성, 댓글, 좋아요, 팔로우, 태그는 생명주기와 중복 규칙이 서로 다르므로 별도 관계로 모델링합니다.
User
core
PK
user_id
ATTR
nickname
Post
N
PK
post_id
FK
author_id
ATTR
body
Comment
N
PK
comment_id
FK
post_id
FK
user_id
Like
bridge
PK
user_id + post_id
FK
user_id
FK
post_id
Follow
self M:N
PK
follower_id + followee_id
FK
follower_id
FK
followee_id
PostTag
bridge
PK
post_id + tag_id
FK
post_id
FK
tag_id
자기참조
Follow는 User가 User를 참조하는 관계입니다.
중복 방지
Like의 복합 PK로 한 사용자의 중복 좋아요를 막습니다.
태그
PostTag로 게시글과 태그의 M:N을 풉니다.