pointview

Tables (5)

orders

  • order_id — BIGINT
  • order_no — VARCHAR(50) — NOT NULL
  • user_id — BIGINT — NOT NULL
  • request_key — VARCHAR(64) — NOT NULL
  • total_amount_won — BIGINT — NOT NULL
  • point_usage_amount_won — BIGINT — NOT NULL
  • payment_amount_won — BIGINT — NOT NULL
  • ordered_at — TIMESTAMP — NOT NULL
  • CHECK — (payment_amount_won = total_amount_won - point_usage_amount_won)

point_ledger

  • point_id — BIGINT
  • point_key — VARCHAR(64) — NOT NULL
  • request_hash — VARCHAR(64) — NOT NULL
  • user_id — BIGINT — NOT NULL
  • tx_type — VARCHAR(20) — NOT NULL
  • EXPIRE — ))
  • amount_won — BIGINT — NOT NULL
  • remained_amount_won — BIGINT — NOT NULL
  • expired_at — TIMESTAMP
  • order_id — BIGINT — Foreign key → orders.order_id
  • related_point_id — BIGINT — Foreign key → point_ledger.point_id
  • created_at — TIMESTAMP — NOT NULL
  • CHECK — (remained_amount_won <= amount_won)
  • CHECK — ( (tx_type IN ('EARN', 'ADMIN_GIFT', 'CANCEL_RETURN') — NOT NULL
  • EXPIRE)) — )
  • CHECK — ( (tx_type IN ('EARN', 'ADMIN_GIFT', 'CANCEL_RETURN')
  • EXPIRE) — AND
  • CHECK — ( (tx_type = 'USE' AND order_id IS NOT NULL) — NOT NULL

point_policy

  • policy_code — VARCHAR(30)
  • max_earn_per_tx_won — BIGINT — NOT NULL
  • max_balance_won — BIGINT — NOT NULL
  • default_expire_days — INT — NOT NULL
  • min_expire_days — INT — NOT NULL
  • max_expire_days — INT — NOT NULL
  • CHECK — (min_expire_days <= default_expire_days)
  • CHECK — (default_expire_days <= max_expire_days)

point_usage_detail

  • usage_detail_id — BIGINT
  • point_id — BIGINT — Foreign key → point_ledger.point_id — NOT NULL
  • detail_type — VARCHAR(30) — NOT NULL
  • USE_CANCEL_REGRANT — ))
  • order_id — BIGINT — Foreign key → orders.order_id — NOT NULL
  • source_point_id — BIGINT — Foreign key → point_ledger.point_id — NOT NULL
  • target_point_id — BIGINT — Foreign key → point_ledger.point_id
  • amount_won — BIGINT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • CHECK — ( (detail_type IN ('USE', 'USE_CANCEL_RESTORE') — NOT NULL
  • order_id (order_id2) — BIGINT — Foreign key → point_ledger.order_id

point_wallet

  • user_id — BIGINT
  • balance_won — BIGINT — NOT NULL
  • version — BIGINT — NOT NULL