ERD 개요
개요
Lumie는 RLS(Row-Level Security) 기반 멀티테넌시를 사용합니다. V18(2026-05-12)에서 schema-per-tenant 전략을 완전 제거하고 단일 public 스키마로 통합했습니다. 모든 테넌트 스코프 테이블은 tenant_id BIGINT NOT NULL 컬럼과 FORCE ROW LEVEL SECURITY 정책으로 행 단위 격리합니다.
별도 물리 스키마(tenant_{slug}, billing)는 존재하지 않습니다. langgraph 스키마는 LangGraph 체크포인터 전용으로 존재하며 테넌트 데이터를 포함하지 않습니다.
스키마별 역할
| 영역 | 테이블 범위 | RLS | 주요 테이블 |
|---|---|---|---|
| 플랫폼 공유 | cross-tenant | 없음 | tenants, owner_directory, federated_identities, tenant_settings |
| 빌링 | cross-tenant | 없음 | plans, subscriptions, invoices, billing_keys, alimtalk_credits |
| 테넌트 스코프 | per-tenant (RLS) | 있음 | 학생/강사/수업/시험/출결/강의/AI/수납 등 모든 업무 데이터 |
| langgraph | 체크포인터 전용 | 없음 | checkpoints, checkpoint_blobs, checkpoint_writes |
DB 역할
| 역할 | 용도 | 권한 |
|---|---|---|
lumie_app | 런타임 연결 | NOSUPERUSER NOBYPASSRLS — RLS 정책 항상 적용 |
postgres | Flyway 마이그레이션 | SUPERUSER — RLS 우회 가능 |
lumie_langgraph | LangGraph 체크포인터 | langgraph 스키마만 접근, public 스키마 접근 없음 |
핵심 마이그레이션 이력
| 버전 | 변경 |
|---|---|
| public V1 | tenants, tenant_settings 생성 |
| public V4 | federated_identities 추가 |
| public V9 | ENTERPRISE → MAX 리네임, custom_id 추가 |
| public V13 | event_publication (Spring Modulith) |
| public V14 | shedlock |
| public V15 | 타임스탬프 TIMESTAMPTZ 전환 |
| public V18 | RLS baseline — schema-per-tenant 폐기, 모든 테넌트 테이블 public 통합 + RLS 일괄 적용 |
| public V22 | owner_directory 신설 |
| public V26 | admins → staff / admin_permissions → staff_permissions |
| public V27 | langgraph 스키마 신설 |
| public V28 | 플랫폼 빌링 테이블 (plans, subscriptions, invoices 등) |
| public V29 | 학원 수납 테이블 (guardians, tuition_invoices 등) |
| public V37 | subscriptions 예약 변경 컬럼 |
| public V38 | billing_operation_locks |
| public V49 | plans.custom_domains 제거 |
| public V51 | ENTERPRISE → MAX (plans 시드) |
| public V52 | attendance_sessions 유니크 제약 |
| public V53 | attendance_records 기본 상태 PENDING |