erd11

Tables (7)

problem

  • id — int8 — Primary key — NOT NULL
  • subject_id — int8 — Foreign key → subject.id — NOT NULL
  • question — text — NOT NULL
  • answer — text — NOT NULL
  • explanation — text
  • type — text — NOT NULL
  • difficulty — int4
  • option1 — text
  • option2 — text
  • option3 — text
  • option4 — text
  • option5 — text
  • is_ai_generated — bool
  • created_at — timestamptz
  • updated_at — timestamptz

study_session

  • id — int8 — Primary key — NOT NULL
  • user_id — int8 — Foreign key → users.id — NOT NULL
  • subject_id — int8 — Foreign key → subject.id — NOT NULL
  • session_type — text — NOT NULL
  • status — text — NOT NULL
  • total_questions — int4
  • correct_count — int4
  • incorrect_count — int4
  • started_at — timestamptz
  • completed_at — timestamptz
  • created_at — timestamptz

subject

  • id — int8 — Primary key — NOT NULL
  • name — text — NOT NULL
  • description — text
  • created_at — timestamptz
  • updated_at — timestamptz

user_answer

  • id — int8 — Primary key — NOT NULL
  • user_id — int8 — Foreign key → users.id — NOT NULL
  • problem_id — int8 — Foreign key → problem.id — NOT NULL
  • session_id — int8 — Foreign key → study_session.id — NOT NULL
  • submitted_answer — text — NOT NULL
  • is_correct — bool — NOT NULL
  • submitted_at — timestamptz

user_statistics

  • id — int8 — Primary key — NOT NULL
  • user_id — int8 — Foreign key → users.id — NOT NULL
  • subject_id — int8 — Foreign key → subject.id — NOT NULL
  • total_attempted — int4
  • correct_count — int4
  • incorrect_count — int4
  • last_studied_at — timestamptz
  • created_at — timestamptz
  • updated_at — timestamptz

users

  • id — int8 — Primary key — NOT NULL
  • google_id — text
  • email — text — NOT NULL
  • nickname — text
  • role — text — NOT NULL
  • free_trial_started_at — timestamptz
  • subscription_started_at — timestamptz
  • created_at — timestamptz
  • updated_at — timestamptz

wrong_answer_bookmark

  • id — int8 — Primary key — NOT NULL
  • user_id — int8 — Foreign key → users.id — NOT NULL
  • problem_id — int8 — Foreign key → problem.id — NOT NULL
  • bookmarked_at — timestamptz
  • review_count — int4
  • last_reviewed_at — timestamptz