50

Tables (11)

code_programming

  • id — BIGINT — NOT NULL
  • subject_id — INT — Foreign key → subject.id
  • question — VARCHAR(1000) — NOT NULL
  • subjective_answer — VARCHAR(2000) — NOT NULL
  • language — VARCHAR(50)
  • difficulty — VARCHAR(16)
  • explanation — VARCHAR(4000)
  • points — INT — NOT NULL
  • is_active — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP
  • updated_at — TIMESTAMP

money_user_have

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • money — BIGINT
  • currency_type — VARCHAR(32) — NOT NULL
  • last_earned_at — TIMESTAMP
  • last_spent_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

problem

  • id — BIGINT — NOT NULL
  • subject_id — INT — Foreign key → subject.id — NOT NULL
  • question_type — VARCHAR(32) — NOT NULL
  • difficulty — VARCHAR(16)
  • question — VARCHAR(2000) — NOT NULL
  • subjective_answer — VARCHAR(2000) — NOT NULL
  • option1 — VARCHAR(2000)
  • option2 — VARCHAR(2000)
  • option3 — VARCHAR(2000)
  • option4 — VARCHAR(2000)
  • option5 — VARCHAR(2000)
  • correct_option — INT
  • explanation — VARCHAR(4000)
  • points — INT — NOT NULL
  • is_active — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

study_session

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • subject_id — INT — Foreign key → subject.id — NOT NULL
  • status — VARCHAR(32) — NOT NULL
  • type — VARCHAR(32) — NOT NULL
  • started_at — TIMESTAMP — NOT NULL
  • ended_at — TIMESTAMP
  • duration_seconds — INT
  • total_questions — INT — NOT NULL
  • correct_count — INT — NOT NULL
  • score — DECIMAL(5,2)
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

subject

  • id — INT — NOT NULL
  • code — VARCHAR(50) — NOT NULL
  • name — VARCHAR(255) — NOT NULL
  • description — VARCHAR(1000)
  • parent_id — INT — Foreign key → subject.id
  • sort_order — INT — NOT NULL
  • is_active — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

subscribe

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • status — VARCHAR(32) — NOT NULL
  • trial_started_at — TIMESTAMP
  • trial_expires_at — TIMESTAMP
  • subscription_started_at — TIMESTAMP
  • subscription_expires_at — TIMESTAMP
  • auto_renew — BOOLEAN — NOT NULL
  • payment_method — VARCHAR(50)
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

user_answer

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • session_id — BIGINT — Foreign key → study_session.id — NOT NULL
  • reference_id — BIGINT — NOT NULL
  • item_type — VARCHAR(32) — NOT NULL
  • submitted_answer — VARCHAR(4000) — NOT NULL
  • is_wrong_answer — BOOLEAN — NOT NULL
  • time_spent_seconds — INT
  • submitted_at — TIMESTAMP — NOT NULL
  • created_at — TIMESTAMP
  • updated_at — TIMESTAMP

user_answer_history

  • id — BIGINT — NOT NULL
  • user_answer_id — BIGINT — Foreign key → user_answer.id — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • action — VARCHAR(32) — NOT NULL
  • old_answer — VARCHAR(4000)
  • new_answer — VARCHAR(4000)
  • changed_at — TIMESTAMP — NOT NULL
  • changed_by — BIGINT

user_statistics

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • subject_id — INT — Foreign key → subject.id — NOT NULL
  • branch — VARCHAR(255)
  • total_attempted — INT — NOT NULL
  • wrong_count — INT — NOT NULL
  • correct_count — INT — NOT NULL
  • accuracy_rate — DECIMAL(5,2)
  • last_studied_at — TIMESTAMP
  • streak_days — INT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

users

  • id — BIGINT — NOT NULL
  • google_id — VARCHAR(255)
  • email — VARCHAR(255) — NOT NULL
  • password_hash — VARCHAR(255)
  • username — VARCHAR(255) — NOT NULL
  • nickname — VARCHAR(255)
  • role — VARCHAR(32) — NOT NULL
  • status — VARCHAR(32) — NOT NULL
  • last_login_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL
  • deleted_at — TIMESTAMP

wrong_answer_bookmark

  • id — BIGINT — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • item_type — VARCHAR(32) — NOT NULL
  • reference_id — BIGINT — NOT NULL
  • bookmarked_at — TIMESTAMP — NOT NULL
  • review_count — INT — NOT NULL
  • last_reviewed_at — TIMESTAMP
  • notes — VARCHAR(2000)
  • created_at — TIMESTAMP
  • updated_at — TIMESTAMP