앱8
테이블 (7)
problem
- id — BIGINT
- subject_id — BIGINT — 외래 키 → subject.id — NOT NULL
- question — TEXT — NOT NULL
- answer — TEXT — NOT NULL
- explanation — TEXT
- type — TEXT — NOT NULL
- difficulty — INTEGER
- option1 — TEXT
- option2 — TEXT
- option3 — TEXT
- option4 — TEXT
- option5 — TEXT
- is_ai_generated — BOOLEAN
- created_at — TIMESTAMPTZ
- updated_at — TIMESTAMPTZ
study_session
- id — BIGINT
- user_id — BIGINT — 외래 키 → users.id — NOT NULL
- subject_id — BIGINT — 외래 키 → subject.id — NOT NULL
- session_type — TEXT — NOT NULL
- status — TEXT — NOT NULL
- total_questions — INTEGER
- correct_count — INTEGER
- incorrect_count — INTEGER
- started_at — TIMESTAMPTZ
- completed_at — TIMESTAMPTZ
- created_at — TIMESTAMPTZ
subject
- id — BIGINT
- name — TEXT — NOT NULL
- description — TEXT
- created_at — TIMESTAMPTZ
- updated_at — TIMESTAMPTZ
user_answer
- id — BIGINT
- user_id — BIGINT — 외래 키 → users.id — NOT NULL
- problem_id — BIGINT — 외래 키 → problem.id — NOT NULL
- session_id — BIGINT — 외래 키 → study_session.id — NOT NULL
- submitted_answer — TEXT — NOT NULL
- is_correct — BOOLEAN — NOT NULL
- submitted_at — TIMESTAMPTZ
- UNIQUE(session_id, — problem_id)
user_statistics
- id — BIGINT
- user_id — BIGINT — 외래 키 → users.id — NOT NULL
- subject_id — BIGINT — 외래 키 → subject.id — NOT NULL
- total_attempted — INTEGER
- correct_count — INTEGER
- incorrect_count — INTEGER
- last_studied_at — TIMESTAMPTZ
- created_at — TIMESTAMPTZ
- updated_at — TIMESTAMPTZ
- UNIQUE(user_id, — subject_id)
users
- id — BIGINT
- google_id — TEXT
- email — TEXT — NOT NULL
- nickname — TEXT
- role — TEXT — NOT NULL
- created_at — TIMESTAMPTZ
- updated_at — TIMESTAMPTZ
wrong_answer_bookmark
- id — BIGINT
- user_id — BIGINT — 외래 키 → users.id — NOT NULL
- problem_id — BIGINT — 외래 키 → problem.id — NOT NULL
- bookmarked_at — TIMESTAMPTZ
- review_count — INTEGER
- last_reviewed_at — TIMESTAMPTZ
- UNIQUE(user_id, — problem_id)