통합 ERD

테이블 (20)

attendances

  • attendance_id — BIGINT — NOT NULL
  • session_id — BIGINT — 외래 키 → course_sessions.session_id — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • status — ENUM('PRESENT', 'LATE', 'ABSENT')
  • tagged_at — TIMESTAMP
  • qr_token — VARCHAR(255)

bookings

  • booking_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • session_id — BIGINT — 외래 키 → course_sessions.session_id — NOT NULL
  • status — ENUM('PENDING_PAYMENT', 'CONFIRMED', 'CANCELLED', 'REFUNDED')
  • payment_deadline — TIMESTAMP
  • created_at — TIMESTAMP
  • INDEX — `idx_booking_status`

categories

  • category_id — BIGINT — NOT NULL
  • name — VARCHAR(50) — NOT NULL

chat_messages

  • message_id — BIGINT — NOT NULL
  • room_id — BIGINT — 외래 키 → chat_rooms.room_id — NOT NULL
  • sender_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • content — TEXT — NOT NULL
  • created_at — TIMESTAMP

chat_rooms

  • room_id — BIGINT — NOT NULL
  • course_id — BIGINT — 외래 키 → courses.course_id — NOT NULL
  • student_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • instructor_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • created_at — TIMESTAMP

coupons

  • coupon_id — BIGINT — NOT NULL
  • code — VARCHAR(50) — NOT NULL
  • discount_amount — DECIMAL(10, 2) — NOT NULL
  • expired_at — TIMESTAMP — NOT NULL

course_logs

  • log_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • course_id — BIGINT — 외래 키 → courses.course_id — NOT NULL
  • total_sessions — INT
  • attended_sessions — INT
  • progress_rate — INT

course_sessions

  • session_id — BIGINT — NOT NULL
  • course_id — BIGINT — 외래 키 → courses.course_id — NOT NULL
  • start_at — TIMESTAMP — NOT NULL
  • end_at — TIMESTAMP — NOT NULL
  • max_capacity — INT — NOT NULL
  • current_count — INT
  • version — INT

courses

  • course_id — BIGINT — NOT NULL
  • instructor_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • category_id — BIGINT — 외래 키 → categories.category_id — NOT NULL
  • title — VARCHAR(200) — NOT NULL
  • description — TEXT
  • price — DECIMAL(10, 2) — NOT NULL
  • open_at — TIMESTAMP — NOT NULL
  • status — ENUM('PREPARING', 'OPEN', 'CLOSED')
  • wish_count — INT
  • created_at — TIMESTAMP
  • INDEX — `idx_course_open_at`

follows

  • follow_id — BIGINT — NOT NULL
  • student_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • instructor_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • created_at — TIMESTAMP

memberships

  • membership_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • status — ENUM('ACTIVE', 'EXPIRED')
  • expired_at — TIMESTAMP — NOT NULL

notifications

  • notice_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • type — ENUM('RESERVATION', 'WAITING', 'REMIND', 'CANCEL', 'PROMOTION') — NOT NULL
  • message — TEXT — NOT NULL
  • is_read — BOOLEAN
  • created_at — TIMESTAMP

onboarding

  • onboarding_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • goal — TEXT
  • level — ENUM('BEGINNER', 'INTERMEDIATE', 'ADVANCED')
  • interest_category — VARCHAR(100)
  • updated_at — TIMESTAMP

payments

  • payment_id — BIGINT — NOT NULL
  • booking_id — BIGINT — 외래 키 → bookings.booking_id — NOT NULL
  • imp_uid — VARCHAR(100) — NOT NULL
  • amount — DECIMAL(10, 2) — NOT NULL
  • status — ENUM('READY', 'PAID', 'CANCELLED', 'FAILED')
  • paid_at — TIMESTAMP

qna

  • qna_id — BIGINT — NOT NULL
  • course_id — BIGINT — 외래 키 → courses.course_id — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • question — TEXT — NOT NULL
  • answer — TEXT
  • is_answered — BOOLEAN
  • created_at — TIMESTAMP

refunds

  • refund_id — BIGINT — NOT NULL
  • payment_id — BIGINT — 외래 키 → payments.payment_id — NOT NULL
  • reason — TEXT
  • refund_amount — DECIMAL(10, 2) — NOT NULL
  • refunded_at — TIMESTAMP

reviews

  • review_id — BIGINT — NOT NULL
  • course_id — BIGINT — 외래 키 → courses.course_id — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • rating — INT — NOT NULL
  • content — TEXT
  • ai_summary — TEXT
  • created_at — TIMESTAMP

user_coupons

  • user_coupon_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • coupon_id — BIGINT — 외래 키 → coupons.coupon_id — NOT NULL
  • is_used — BOOLEAN
  • used_at — TIMESTAMP

users

  • user_id — BIGINT — NOT NULL
  • email — VARCHAR(100) — NOT NULL
  • password — VARCHAR(255)
  • name — VARCHAR(50) — NOT NULL
  • role — ENUM('STUDENT', 'INSTRUCTOR', 'ADMIN') — NOT NULL
  • social_provider — ENUM('LOCAL', 'GOOGLE', 'KAKAO')
  • social_id — VARCHAR(255)
  • created_at — TIMESTAMP
  • INDEX — `idx_user_email`

waiting_lines

  • waiting_id — BIGINT — NOT NULL
  • user_id — BIGINT — 외래 키 → users.user_id — NOT NULL
  • session_id — BIGINT — 외래 키 → course_sessions.session_id — NOT NULL
  • waiting_number — INT — NOT NULL
  • status — ENUM('WAITING', 'PROMOTED', 'EXPIRED')
  • created_at — TIMESTAMP