My Order Service

Tables (7)

coupon_batch (사용자 쿠폰 배치)

  • id — TEXT — Primary key — NOT NULL
  • name (배치명) — VARCHAR
  • discount_type (할인유형) — VARCHAR
  • discount_value (할인값) — INT
  • total_count (전체 쿠폰 수) — INT
  • issued_count (발행 쿠폰 수) — INT
  • expires_at (만료일) — TIMESTAMP
  • create_at (등록일) — TIMESTAMP

order_items (주문 상품)

  • id (Key) — TEXT — Primary key — NOT NULL
  • order_id (주문 ID) — TEXT — Foreign key → orders.id — NOT NULL
  • product_id (상품 ID) — TEXT — Foreign key → products.id — NOT NULL
  • quantity (주문 수량) — INT — NOT NULL
  • unit_price (상품 가격) — BIGINT — NOT NULL
  • line_amount (총액) — BIGINT — NOT NULL

orders (주문 정보)

  • id (Key) — TEXT — Primary key — NOT NULL
  • user_id (사용자 ID) — TEXT — Foreign key → users.id — NOT NULL
  • total_amount (전체 값) — BIGINT — NOT NULL
  • discount_amount (할인 값) — BIGINT — NOT NULL
  • paid_amount (지불한 값) — BIGINT — NOT NULL
  • status (주문 상태) — TEXT — NOT NULL
  • paid_at (지불일) — TIMESTAMP — NOT NULL
  • created_at (등록일) — TIMESTAMP — NOT NULL

products (상품 정보)

  • id (Key) — TEXT — Primary key — NOT NULL
  • name (상품명) — TEXT — NOT NULL
  • price (상품가격) — BIGINT — NOT NULL
  • stock (재고 수량) — INT — NOT NULL
  • create_at (등록일) — TIMESTAMP — NOT NULL
  • updated_at (Field)

user_coupon (사용자 쿠폰)

  • id — TEXT — Primary key — NOT NULL
  • user_id (사용자 ID) — TEXT — Foreign key → users.id — NOT NULL
  • batch_id (배치 ID) — TEXT — Foreign key → coupon_batch.id — NOT NULL
  • code (쿠폰 코드) — VARCHAR — NOT NULL
  • status (사용 여부) — VARCHAR — NOT NULL
  • issued_at (발행일) — TIMESTAMP — NOT NULL
  • used_at (사용일) — TIMESTAMP

users

  • id — TEXT — Primary key — NOT NULL
  • balance (잔액) — BIGINT — NOT NULL
  • version (버전) — INT — NOT NULL
  • create_at (등록일) — TIMESTAMP — NOT NULL
  • updated_at (수정일) — TIMESTAMP — NOT NULL

wallet_ledger (금액 정보)

  • id — TEXT — Primary key — NOT NULL
  • user_id (사용자 ID) — TEXT — Foreign key → users.id — NOT NULL
  • amount (충전 값) — BIGINT — NOT NULL
  • reason (충전 사유) — TEXT
  • created_at (등록일) — TIMESTAMP — NOT NULL