test
Tables (29)
admin_roles
- admin_id — BIGINT — Foreign key → admins.id — NOT NULL — 관리자 FK
- role_id — BIGINT — Foreign key → roles.id — NOT NULL — 역할 FK
- created_at — DATETIME — NOT NULL — 부여일시
admins
- id — BIGINT — Primary key — NOT NULL — PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID
- email — VARCHAR(255) — NOT NULL — 이메일 (BOS 로그인 ID)
- password_hash — VARCHAR(255) — NOT NULL — 비밀번호 해시
- name — VARCHAR(100) — NOT NULL — 관리자 이름
- otp_secret — VARCHAR(100) — Google OTP 시크릿 키 (암호화)
- is_otp_enabled — TINYINT(1) — NOT NULL — OTP 2단계 인증 활성화 여부
- status — VARCHAR(20) — NOT NULL — 상태 (ACTIVE / SUSPENDED)
- last_login_at — DATETIME — 마지막 로그인 일시
- last_login_ip — VARCHAR(45) — 마지막 로그인 IP
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_admins_status
auth_tokens
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 회원 FK
- token_hash — VARCHAR(500) — NOT NULL — Refresh Token 해시값
- device_info — VARCHAR(500) — 디바이스 정보 (User-Agent 등)
- ip_address — VARCHAR(45) — 발급 IP
- expired_at — DATETIME — NOT NULL — 만료일시
- revoked_at — DATETIME — 폐기일시 (로그아웃 시)
- created_at — DATETIME — NOT NULL — 발급일시
- INDEX — idx_token_member_id
- INDEX — idx_token_hash
- INDEX — idx_token_expired_at
coupons
- id — BIGINT — Primary key — NOT NULL — PK
- code — VARCHAR(50) — NOT NULL — 쿠폰 코드
- name — VARCHAR(200) — NOT NULL — 쿠폰 이름
- discount_type — VARCHAR(20) — NOT NULL — 할인 유형 (FIXED / PERCENT)
- discount_value — DECIMAL(10, 0) — NOT NULL — 할인값 (원 또는 %)
- max_discount — DECIMAL(10, 0) — 최대 할인 금액 (PERCENT 시 상한)
- min_order_price — DECIMAL(10, 0) — NOT NULL — 최소 주문 금액
- total_quantity — INT — 총 발급 수량 (NULL이면 무제한)
- used_quantity — INT — NOT NULL — 사용된 수량
- target_type — VARCHAR(20) — NOT NULL — 적용 대상 (ALL / SPECIFIC_COURSE)
- is_active — TINYINT(1) — NOT NULL — 활성화 여부
- started_at — DATETIME — NOT NULL — 쿠폰 시작일시
- expired_at — DATETIME — NOT NULL — 쿠폰 만료일시
- created_by — BIGINT — 생성 관리자 FK (admins.id)
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_coupons_is_active
- INDEX — idx_coupons_expired_at
course_categories
- id — BIGINT — Primary key — NOT NULL — PK
- parent_id — BIGINT — Foreign key → course_categories.id — 부모 카테고리 FK (NULL이면 최상위)
- name — VARCHAR(100) — NOT NULL — 카테고리 이름
- slug — VARCHAR(100) — NOT NULL — URL 슬러그
- depth — INT — NOT NULL — 깊이 (0: 대분류, 1: 중분류, 2: 소분류)
- sort_order — INT — NOT NULL — 정렬 순서
- is_active — TINYINT(1) — NOT NULL — 활성화 여부
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_category_parent_id
- INDEX — idx_category_depth
course_reviews
- id — BIGINT — Primary key — NOT NULL — PK
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 작성자 FK
- enrollment_id — BIGINT — Foreign key → enrollments.id — NOT NULL — 수강 FK (수강자만 리뷰 작성 가능)
- rating — TINYINT — NOT NULL — 평점 (1~5)
- content — TEXT — 리뷰 내용
- is_hidden — TINYINT(1) — NOT NULL — 숨김 여부 (관리자 처리)
- created_at — DATETIME — NOT NULL — 작성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- deleted_at — DATETIME — 삭제일시 (Soft Delete)
- INDEX — idx_reviews_course_id
- INDEX — idx_reviews_rating
- INDEX — idx_reviews_created_at
course_sections
- id — BIGINT — Primary key — NOT NULL — PK
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK
- title — VARCHAR(300) — NOT NULL — 섹션 제목
- sort_order — INT — NOT NULL — 섹션 순서
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_sections_course_id
course_videos
- id — BIGINT — Primary key — NOT NULL — PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID
- section_id — BIGINT — Foreign key → course_sections.id — NOT NULL — 섹션 FK
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK (빠른 조회용 역정규화)
- title — VARCHAR(300) — NOT NULL — 영상 제목
- description — TEXT — 영상 설명
- sort_order — INT — NOT NULL — 영상 순서
- duration — INT — NOT NULL — 영상 길이 (초)
- is_preview — TINYINT(1) — NOT NULL — 미리보기 공개 여부
- status — VARCHAR(20) — NOT NULL — 영상 상태 (PENDING / TRANSCODING / READY / FAILED)
- original_s3_key — VARCHAR(500) — 원본 S3 키
- original_size — BIGINT — 원본 파일 크기 (bytes)
- hls_url — VARCHAR(500) — HLS 스트리밍 URL (CDN, m3u8)
- dash_url — VARCHAR(500) — DASH 스트리밍 URL (CDN, mpd)
- thumbnail_url — VARCHAR(500) — 영상 썸네일 URL (CDN)
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_videos_section_id
- INDEX — idx_videos_course_id
- INDEX — idx_videos_status
courses
- id — BIGINT — Primary key — NOT NULL — PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID
- instructor_id — BIGINT — Foreign key → members.id — NOT NULL — 강사 FK (members.id)
- category_id — BIGINT — Foreign key → course_categories.id — NOT NULL — 카테고리 FK
- title — VARCHAR(500) — NOT NULL — 강의 제목
- subtitle — VARCHAR(500) — 부제목
- description — TEXT — 강의 설명
- thumbnail_url — VARCHAR(500) — 썸네일 이미지 URL (S3)
- preview_video_url — VARCHAR(500) — 미리보기 영상 URL (CDN)
- level — VARCHAR(20) — NOT NULL — 난이도 (BEGINNER / INTERMEDIATE / ADVANCED / ALL)
- language — VARCHAR(10) — NOT NULL — 언어 코드
- price — DECIMAL(10, 0) — NOT NULL — 정가 (원)
- discount_price — DECIMAL(10, 0) — 할인가 (원)
- status — VARCHAR(20) — NOT NULL — 강의 상태 (DRAFT / PENDING / PUBLISHED / CLOSED)
- is_live — TINYINT(1) — NOT NULL — 라이브 강의 여부
- total_duration — INT — NOT NULL — 총 강의 시간 (초)
- enrollment_count — INT — NOT NULL — 수강생 수 (캐싱용, 실시간 반영)
- rating_avg — DECIMAL(3, 2) — NOT NULL — 평균 평점 (캐싱용)
- rating_count — INT — NOT NULL — 리뷰 수 (캐싱용)
- published_at — DATETIME — 공개일시
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- deleted_at — DATETIME — 삭제일시 (Soft Delete)
- INDEX — idx_courses_instructor_id
- INDEX — idx_courses_category_id
- INDEX — idx_courses_status
- INDEX — idx_courses_is_live
- INDEX — idx_courses_published_at
- INDEX — idx_courses_enrollment_count
enrollments
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 수강생 FK
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK
- order_id — BIGINT — 주문 FK (무료 강의는 NULL)
- status — VARCHAR(20) — NOT NULL — 수강 상태 (ACTIVE / EXPIRED / REFUNDED)
- progress_rate — DECIMAL(5, 2) — NOT NULL — 수강 진도율 (%)
- completed_at — DATETIME — 수강 완료일시
- expired_at — DATETIME — 수강 만료일시 (기간제)
- created_at — DATETIME — NOT NULL — 수강 시작일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_enrollments_course_id
- INDEX — idx_enrollments_status
- INDEX — idx_enrollments_created_at
instructor_settlements
- id — BIGINT — Primary key — NOT NULL — PK
- instructor_id — BIGINT — Foreign key → members.id — NOT NULL — 강사 FK
- period_year — INT — NOT NULL — 정산 연도
- period_month — INT — NOT NULL — 정산 월
- total_sales — DECIMAL(15, 0) — NOT NULL — 총 매출액
- platform_fee — DECIMAL(15, 0) — NOT NULL — 플랫폼 수수료
- settlement_amount — DECIMAL(15, 0) — NOT NULL — 정산 금액
- status — VARCHAR(20) — NOT NULL — 정산 상태 (PENDING / CONFIRMED / PAID)
- paid_at — DATETIME — 지급일시
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_settlement_status
live_chats
- id — BIGINT — Primary key — NOT NULL — PK
- session_id — BIGINT — Foreign key → live_sessions.id — NOT NULL — 라이브 세션 FK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 작성자 FK
- message — TEXT — NOT NULL — 채팅 메시지
- is_blocked — TINYINT(1) — NOT NULL — 차단 여부
- created_at — DATETIME — NOT NULL — 작성일시
- INDEX — idx_live_chat_session_id
- INDEX — idx_live_chat_created_at
live_sessions
- id — BIGINT — Primary key — NOT NULL — PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK
- instructor_id — BIGINT — Foreign key → members.id — NOT NULL — 강사 FK
- title — VARCHAR(300) — NOT NULL — 라이브 세션 제목
- description — TEXT — 설명
- status — VARCHAR(20) — NOT NULL — 상태 (SCHEDULED / LIVE / ENDED / CANCELLED)
- rtmp_stream_key — VARCHAR(200) — NOT NULL — RTMP 스트림 키 (강사 송출용)
- rtmp_server_url — VARCHAR(300) — NOT NULL — RTMP 서버 URL
- hls_play_url — VARCHAR(500) — HLS 시청 URL (CDN 경유)
- max_viewers — INT — NOT NULL — 최대 동시접속자 수
- current_viewers — INT — NOT NULL — 현재 동시접속자 수 (Redis 캐싱값)
- scheduled_at — DATETIME — NOT NULL — 예약 시작 일시
- started_at — DATETIME — 실제 시작 일시
- ended_at — DATETIME — 종료 일시
- vod_video_id — BIGINT — Foreign key → course_videos.id — 종료 후 VOD 전환된 영상 FK (course_videos.id)
- created_at — DATETIME — NOT NULL — 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_live_course_id
- INDEX — idx_live_status
- INDEX — idx_live_scheduled_at
member_coupons
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 회원 FK
- coupon_id — BIGINT — Foreign key → coupons.id — NOT NULL — 쿠폰 FK
- status — VARCHAR(20) — NOT NULL — 상태 (ISSUED / USED / EXPIRED)
- used_at — DATETIME — 사용일시
- order_id — BIGINT — 사용된 주문 FK
- created_at — DATETIME — NOT NULL — 발급일시
- INDEX — idx_mc_coupon_id
- INDEX — idx_mc_status
member_pass_verifications
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — 회원 FK (가입 전 인증은 NULL 가능)
- ci — VARCHAR(500) — PASS 연계정보 CI (개인 고유키)
- di — VARCHAR(500) — PASS 중복가입확인 DI
- name — VARCHAR(50) — 인증된 실명
- phone — VARCHAR(20) — 인증된 휴대폰 번호
- birth_date — DATE — 생년월일
- gender — VARCHAR(10) — 성별 (MALE / FEMALE)
- status — VARCHAR(20) — NOT NULL — 인증 상태 (PENDING / SUCCESS / FAILED)
- expired_at — DATETIME — 인증 만료일시
- created_at — DATETIME — NOT NULL — 인증 요청일시
- INDEX — idx_pass_member_id
- INDEX — idx_pass_ci
- INDEX — idx_pass_phone
member_roles
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 회원 FK
- role_id — BIGINT — Foreign key → roles.id — NOT NULL — 역할 FK
- granted_by — BIGINT — 권한 부여한 관리자 FK (members.id)
- created_at — DATETIME — NOT NULL — 부여일시
- INDEX — idx_mr_role_id
member_social_auths
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 회원 FK
- provider — VARCHAR(20) — NOT NULL — 소셜 제공자 (NAVER / KAKAO / GOOGLE)
- provider_id — VARCHAR(255) — NOT NULL — 소셜 제공자의 사용자 고유 ID
- access_token — TEXT — 소셜 액세스 토큰 (암호화 저장)
- refresh_token — TEXT — 소셜 리프레시 토큰 (암호화 저장)
- created_at — DATETIME — NOT NULL — 연동일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_social_member_id
members
- id — BIGINT — Primary key — NOT NULL — 회원 PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID (API 응답에 사용)
- email — VARCHAR(255) — NOT NULL — 이메일 (로그인 ID)
- password_hash — VARCHAR(255) — 비밀번호 해시 (소셜 로그인만 사용 시 NULL)
- nickname — VARCHAR(100) — NOT NULL — 닉네임
- profile_image — VARCHAR(500) — 프로필 이미지 URL (S3)
- phone — VARCHAR(20) — 휴대폰 번호 (PASS 인증 완료 후 저장)
- is_verified — TINYINT(1) — NOT NULL — PASS 본인인증 완료 여부
- status — VARCHAR(20) — NOT NULL — 회원 상태 (ACTIVE / SUSPENDED / WITHDRAWN)
- created_at — DATETIME — NOT NULL — 가입일시
- updated_at — DATETIME — NOT NULL — 수정일시
- deleted_at — DATETIME — 탈퇴일시 (Soft Delete)
- INDEX — idx_members_status
- INDEX — idx_members_phone
notifications
- id — BIGINT — Primary key — NOT NULL — PK
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 수신자 FK
- type — VARCHAR(50) — NOT NULL — 알림 유형 (PURCHASE / LIVE_START / COMMENT / SETTLEMENT)
- title — VARCHAR(200) — NOT NULL — 알림 제목
- message — TEXT — NOT NULL — 알림 내용
- link — VARCHAR(500) — 이동 링크
- is_read — TINYINT(1) — NOT NULL — 읽음 여부
- read_at — DATETIME — 읽은 일시
- created_at — DATETIME — NOT NULL — 생성일시
- INDEX — idx_notif_member_id
- INDEX — idx_notif_is_read
- INDEX — idx_notif_created_at
order_items
- id — BIGINT — Primary key — NOT NULL — PK
- order_id — BIGINT — Foreign key → orders.id — NOT NULL — 주문 FK
- course_id — BIGINT — Foreign key → courses.id — NOT NULL — 강의 FK
- course_title — VARCHAR(500) — NOT NULL — 강의 제목 스냅샷
- original_price — DECIMAL(10, 0) — NOT NULL — 정가 스냅샷
- discount_price — DECIMAL(10, 0) — NOT NULL — 할인 금액
- final_price — DECIMAL(10, 0) — NOT NULL — 결제 금액
- refund_status — VARCHAR(20) — 환불 상태 (NONE / REQUESTED / COMPLETED)
- refunded_price — DECIMAL(10, 0) — NOT NULL — 환불 금액
- refunded_at — DATETIME — 환불일시
- refund_reason — VARCHAR(500) — 환불 사유
- created_at — DATETIME — NOT NULL — 생성일시
- INDEX — idx_order_items_order_id
- INDEX — idx_order_items_course_id
- INDEX — idx_order_items_refund
orders
- id — BIGINT — Primary key — NOT NULL — PK
- uuid — VARCHAR(36) — NOT NULL — 외부 노출용 UUID (PG사 주문번호)
- member_id — BIGINT — Foreign key → members.id — NOT NULL — 주문자 FK
- status — VARCHAR(20) — NOT NULL — 주문 상태 (PENDING / PAID / CANCELLED / REFUNDED / PARTIAL_REFUNDED)
- original_price — DECIMAL(10, 0) — NOT NULL — 정가 합계
- discount_price — DECIMAL(10, 0) — NOT NULL — 할인 금액
- coupon_discount — DECIMAL(10, 0) — NOT NULL — 쿠폰 할인 금액
- final_price — DECIMAL(10, 0) — NOT NULL — 최종 결제 금액
- coupon_id — BIGINT — Foreign key → coupons.id — 사용 쿠폰 FK
- pg_provider — VARCHAR(50) — PG사 (TOSS / IAMPORT / NICEPAY 등)
- pg_transaction_id — VARCHAR(255) — PG사 거래 ID
- paid_at — DATETIME — 결제 완료일시
- cancelled_at — DATETIME — 취소일시
- created_at — DATETIME — NOT NULL — 주문 생성일시
- updated_at — DATETIME — NOT NULL — 수정일시
- INDEX — idx_orders_member_id
- INDEX — idx_orders_status
- INDEX — idx_orders_pg_transaction_id
- INDEX — idx_orders_created_at
payment_histories
- id — BIGINT — Primary key — NOT NULL — PK
- order_id — BIGINT — Foreign key → orders.id — NOT NULL — 주문 FK
- type — VARCHAR(30) — NOT NULL — 이력 유형 (PAYMENT / CANCEL / REFUND / PARTIAL_REFUND)
- amount — DECIMAL(10, 0) — NOT NULL — 금액
- pg_provider — VARCHAR(50) — PG사
- pg_transaction_id — VARCHAR(255) — PG사 거래 ID
- pg_raw_response — TEXT — PG사 원문 응답 (JSON, 장애 추적용)
- status — VARCHAR(20) — NOT NULL — 처리 상태 (SUCCESS / FAILED / PENDING)
- created_at — DATETIME — NOT NULL — 처리일시
- INDEX — idx_ph_order_id
- INDEX — idx_ph_pg_transaction
- INDEX — idx_ph_created_at
permissions
- id — BIGINT — Primary key — NOT NULL — PK
- code — VARCHAR(100) — NOT NULL — 권한 코드 (예: COURSE_CREATE)
- name — VARCHAR(100) — NOT NULL — 권한 이름
- module — VARCHAR(50) — NOT NULL — 모듈 (CORE / PLATFORM / BOS / BATCH / STREAMING)
- description — VARCHAR(500) — 권한 설명
- created_at — DATETIME — NOT NULL — 생성일시
role_permissions
- role_id — BIGINT — Foreign key → roles.id — NOT NULL — 역할 FK
- permission_id — BIGINT — Foreign key → permissions.id — NOT NULL — 권한 FK
- created_at — DATETIME — NOT NULL — 매핑일시
roles
- id — BIGINT — Primary key — NOT NULL — PK
- code — VARCHAR(50) — NOT NULL — 역할 코드 (MEMBER / INSTRUCTOR / ADMIN / SUPER_ADMIN / CS)
- name — VARCHAR(100) — NOT NULL — 역할 이름
- description — VARCHAR(500) — 역할 설명
- is_system — TINYINT(1) — NOT NULL — 시스템 기본 역할 여부 (삭제 불가)
- created_at — DATETIME — NOT NULL — 생성일시
settlement_details
- id — BIGINT — Primary key — NOT NULL — PK
- settlement_id — BIGINT — Foreign key → instructor_settlements.id — NOT NULL — 정산 FK
- order_item_id — BIGINT — Foreign key → order_items.id — NOT NULL — 주문 상품 FK
- course_id — BIGINT — NOT NULL — 강의 FK
- sales_amount — DECIMAL(10, 0) — NOT NULL — 매출액
- platform_fee — DECIMAL(10, 0) — NOT NULL — 수수료
- settlement_amount — DECIMAL(10, 0) — NOT NULL — 정산액
- created_at — DATETIME — NOT NULL — 생성일시
- INDEX — idx_sd_settlement_id
- INDEX — idx_sd_order_item_id
statistics_snapshots
- id — BIGINT — Primary key — NOT NULL — PK
- snapshot_date — DATE — NOT NULL — 집계 기준일
- type — VARCHAR(50) — NOT NULL — 집계 유형 (DAILY_SALES / DAILY_ENROLLMENT / COURSE_STATS)
- target_id — BIGINT — 대상 ID (강의 ID, 강사 ID 등)
- data — JSON — NOT NULL — 집계 데이터 (JSON)
- created_at — DATETIME — NOT NULL — 생성일시
- INDEX — idx_snapshot_type
- INDEX — idx_snapshot_date
transcoding_jobs
- id — BIGINT — Primary key — NOT NULL — PK
- video_id — BIGINT — Foreign key → course_videos.id — NOT NULL — 영상 FK
- original_s3_key — VARCHAR(500) — NOT NULL — 원본 S3 키
- job_id — VARCHAR(200) — 트랜스코딩 서비스 Job ID (AWS MediaConvert 등)
- status — VARCHAR(20) — NOT NULL — 상태 (QUEUED / PROCESSING / COMPLETED / FAILED)
- resolutions — JSON — 생성된 해상도 목록 (JSON 배열: 360, 720, 1080)
- output_hls_key — VARCHAR(500) — 출력 HLS S3 키
- output_dash_key — VARCHAR(500) — 출력 DASH S3 키
- error_message — TEXT — 실패 메시지
- retry_count — INT — NOT NULL — 재시도 횟수
- started_at — DATETIME — 작업 시작일시
- completed_at — DATETIME — 작업 완료일시
- created_at — DATETIME — NOT NULL — 등록일시
- INDEX — idx_tc_video_id
- INDEX — idx_tc_status
- INDEX — idx_tc_created_at
video_progresses
- id — BIGINT — Primary key — NOT NULL — PK
- enrollment_id — BIGINT — Foreign key → enrollments.id — NOT NULL — 수강 FK
- video_id — BIGINT — Foreign key → course_videos.id — NOT NULL — 영상 FK
- member_id — BIGINT — NOT NULL — 수강생 FK (빠른 조회용 역정규화)
- last_position — INT — NOT NULL — 마지막 시청 위치 (초)
- is_completed — TINYINT(1) — NOT NULL — 완료 여부
- completed_at — DATETIME — 완료일시
- updated_at — DATETIME — NOT NULL — 최종 시청일시
- INDEX — idx_progress_member_id