졸작 초기 ERD
테이블 (10)
community_post
- post_id — BIGINT — 기본 키
- created_at — DATETIME — 기본 키 — NOT NULL
- entry_id (entry_id2) — BIGINT — 외래 키 → diary_entry.entry_id
- user_id (user_id2) — BIGINT — 외래 키 → diary_entry.user_id
- visibility — ENUM('PUBLIC', 'PRIVATE') — NOT NULL
- updated_at — DATETIME — NOT NULL
conversation_message
- message_id (message_id2) — BIGINT — 외래 키 → sentence_analysis.message_id — NOT NULL
- entry_id — BIGINT — NOT NULL
- sender_type — ENUM('USER', 'AI') — NOT NULL
- message_text — TEXT — NOT NULL
- audio_url — VARCHAR(500)
- display_order — INT — NOT NULL
- created_at — DATETIME — NOT NULL
device_token
- user_id (user_id2) — BIGINT — 외래 키 → users.user_id
- email — VARCHAR(255) — 외래 키 → users.email — NOT NULL
- token_id — BIGINT
- fcm_token — VARCHAR(500) — NOT NULL
- device_type — ENUM('ANDROID', 'IOS', 'WEB') — NOT NULL
- created_at — DATETIME — NOT NULL
- updated_at — DATETIME — NOT NULL
diary_entry
- entry_id — BIGINT — 기본 키
- user_id (user_id2) — BIGINT — 외래 키 → users.user_id
- entry_date — DATE — NOT NULL
- title — VARCHAR(255)
- summary_text — TEXT
- one_line_summary — VARCHAR(255)
- main_emotion — VARCHAR(50)
- emotion_score_avg — FLOAT
- peak_emotion_segment_id — BIGINT
- is_shared — BOOLEAN — NOT NULL
- created_at — DATETIME — NOT NULL
- updated_at — DATETIME — NOT NULL
diary_topic
- entry_id — BIGINT — 기본 키 — NOT NULL
- topic_id (topic_id2) — BIGINT — 외래 키 → topic_tag.topic_id
- post_id — BIGINT — 외래 키 → topic_tag.post_id
- weight — FLOAT
post_comment
- post_id (post_id2) — BIGINT — 외래 키 → community_post.post_id
- created_at (created_at2) — DATETIME — 외래 키 → community_post.created_at — NOT NULL
- entry_id (entry_id2) — BIGINT — 외래 키 → community_post.entry_id
- user_id (user_id2) — BIGINT — 외래 키 → community_post.user_id
- comment_id — BIGINT
- content — TEXT — NOT NULL
- parent_comment_id — BIGINT
- created_at — DATETIME — NOT NULL
- updated_at — DATETIME — NOT NULL
post_like
- post_id — BIGINT — 기본 키 — NOT NULL
- user_id — BIGINT — 기본 키 — NOT NULL
- entry_id (entry_id2) — BIGINT — 외래 키 → community_post.entry_id
- user_id (user_id2) — BIGINT — 외래 키 → community_post.user_id
- created_at (created_at2) — DATETIME — 외래 키 → community_post.created_at — NOT NULL
- created_at — DATETIME — NOT NULL
sentence_analysis
- sentence_id — BIGINT — 기본 키
- message_id — BIGINT — 기본 키 — NOT NULL
- entry_id (entry_id2) — BIGINT — 외래 키 → diary_entry.entry_id
- sentence_index — INT — NOT NULL
- sentence_text — TEXT — NOT NULL
- emotion_score — FLOAT
- emotion_label — VARCHAR(50)
- is_peak — BOOLEAN — NOT NULL
- created_at — DATETIME — NOT NULL
topic_tag
- topic_id — BIGINT — 기본 키
- post_id — BIGINT — 외래 키 → community_post.post_id
- name — VARCHAR(100) — NOT NULL
- category — VARCHAR(100)
- created_at — DATETIME — NOT NULL
users
- user_id — BIGINT — 기본 키
- email — VARCHAR(255) — 기본 키 — NOT NULL
- password_hash — VARCHAR(255) — NOT NULL
- nickname — VARCHAR(100) — NOT NULL
- gender — VARCHAR(20)
- birth_year — INT
- created_at — DATETIME — NOT NULL
- updated_at — DATETIME — NOT NULL