japay

Tables (5)

accounts

  • account_id — BIGINT
  • user_id — BIGINT — Foreign key — NOT NULL
  • account_number — VARCHAR(255) — NOT NULL — 암호화된 계좌번호
  • balance — DECIMAL(20, 4) — NOT NULL — 잔액(엔화는 소수점 이하 0으로 관리 가능)
  • currency — ENUM('KRW', 'JPY') — NOT NULL — 통화 구분
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL
  • Key — Foreign key → users.user_id — NOT NULL

balance_histories

  • history_id — BIGINT
  • account_id — BIGINT — Foreign key → accounts.account_id — NOT NULL
  • transfer_id — BIGINT — Foreign key → transfers.transfer_id — NOT NULL
  • change_amount — DECIMAL(20, 4) — NOT NULL — 변동액(+/-)
  • current_balance — DECIMAL(20, 4) — NOT NULL — 변동 후 최종 잔액
  • created_at — DATETIME(6) — NOT NULL
  • Key — Foreign key → accounts.Key — NOT NULL

exchange_rates

  • rate_id — BIGINT
  • currency_pair — VARCHAR(10) — NOT NULL — KRW_JPY 고정
  • base_rate — DECIMAL(15, 6) — NOT NULL — 1엔당 원화 가격 (예: 9.15)
  • provider — VARCHAR(50)
  • updated_at — DATETIME(6) — NOT NULL

transfers

  • transfer_id — BIGINT
  • sender_user_id — BIGINT — Foreign key — NOT NULL — 보내는 사람(인증 정보)
  • sender_account_id — BIGINT — Foreign key → accounts.account_id — NOT NULL — 출금된 원화 계좌
  • receiver_account_id — BIGINT — Foreign key → accounts.account_id — NOT NULL — 입금된 엔화 계좌
  • send_amount_krw — DECIMAL(20, 4) — NOT NULL — 실제 차감된 원화 금액
  • receive_amount_jpy — DECIMAL(20, 4) — NOT NULL — 실제 입금된 엔화 금액
  • applied_exchange_rate — DECIMAL(15, 6) — NOT NULL — 당시 적용 환율
  • transfer_type — ENUM('DOMESTIC', 'OVERSEAS') — NOT NULL
  • status — ENUM('SUCCESS', 'FAILED') — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • Key — Foreign key → users.user_id — NOT NULL

users

  • user_id — BIGINT — Primary key — NOT NULL
  • loginId (login_id) — VARCHAR(50) — NOT NULL — 로그인 ID
  • password — VARCHAR(255) — NOT NULL — 암호화된 비밀번호
  • name — VARCHAR(50) — NOT NULL — 사용자 실명(수취인 확인용)
  • status — ENUM('ACTIVE', 'BLOCK', 'WITHDRAW')
  • role — VARCHAR(20)
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL