ss

Tables (12)

categories

  • id — BIGINT — Primary key — NOT NULL
  • parent_id — BIGINT — Foreign key → categories.id
  • name — VARCHAR(50) — NOT NULL
  • depth — TINYINT — NOT NULL
  • sort_order — INT — NOT NULL

coupons

  • id — BIGINT — Primary key — NOT NULL
  • issued_by — BIGINT — Foreign key → users.id — NOT NULL
  • store_id — BIGINT — Foreign key → stores.id
  • name — VARCHAR(100) — NOT NULL
  • discount_type — VARCHAR(10) — NOT NULL
  • discount_value — INT — NOT NULL
  • min_order_amount — INT — NOT NULL
  • max_issue_count — INT
  • issued_count — INT — NOT NULL
  • started_at — DATETIME — NOT NULL
  • expired_at — DATETIME — NOT NULL
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL

delivery_addresses

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • label — VARCHAR(50)
  • recipient_name — VARCHAR(50) — NOT NULL
  • phone — VARCHAR(20) — NOT NULL
  • zip_code — VARCHAR(10) — NOT NULL
  • street_address — VARCHAR(200) — NOT NULL
  • detail_address — VARCHAR(200)
  • is_default — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL

order_items

  • id — BIGINT — Primary key — NOT NULL
  • order_id — BIGINT — Foreign key → orders.id — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • product_option_id — BIGINT — Foreign key → product_options.id — NOT NULL
  • user_coupon_id — BIGINT — Foreign key → user_coupons.id
  • product_name — VARCHAR(200) — NOT NULL
  • option_snapshot — VARCHAR(500) — NOT NULL
  • unit_price — INT — NOT NULL
  • quantity — INT — NOT NULL
  • item_total_amount — INT — NOT NULL
  • coupon_discount — INT — NOT NULL
  • grade_discount — INT — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL

orders

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • delivery_address_id — BIGINT — Foreign key → delivery_addresses.id — NOT NULL
  • idempotency_key — VARCHAR(100) — NOT NULL
  • status — VARCHAR(30) — NOT NULL
  • total_product_amount — INT — NOT NULL
  • discount_by_coupon — INT — NOT NULL
  • discount_by_grade — INT — NOT NULL
  • discount_by_point — INT — NOT NULL
  • final_amount — INT — NOT NULL
  • used_point — INT — NOT NULL
  • earned_point — INT — NOT NULL
  • memo — VARCHAR(500)
  • ordered_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

payments

  • id — BIGINT — Primary key — NOT NULL
  • order_id — BIGINT — Foreign key → orders.id — NOT NULL
  • toss_payment_key — VARCHAR(200) — NOT NULL
  • toss_order_id — VARCHAR(200) — NOT NULL
  • method — VARCHAR(30) — NOT NULL
  • status — VARCHAR(30) — NOT NULL
  • requested_amount — INT — NOT NULL
  • approved_amount — INT
  • cancel_amount — INT — NOT NULL
  • cancel_reason — VARCHAR(500)
  • requested_at — DATETIME — NOT NULL
  • approved_at — DATETIME
  • updated_at — DATETIME — NOT NULL

point_histories

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • order_id — BIGINT — Foreign key → orders.id
  • point_type — VARCHAR(20) — NOT NULL
  • amount — INT — NOT NULL
  • balance_snapshot — INT — NOT NULL
  • description — VARCHAR(200)
  • created_at — DATETIME — NOT NULL

product_options

  • id — BIGINT — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • sku_code — VARCHAR(100) — NOT NULL
  • color — VARCHAR(50)
  • size — VARCHAR(20)
  • extra_option — VARCHAR(100)
  • additional_price — INT — NOT NULL
  • stock_quantity — INT — NOT NULL
  • status — VARCHAR(20) — NOT NULL

products

  • id — BIGINT — Primary key — NOT NULL
  • store_id — BIGINT — Foreign key → stores.id — NOT NULL
  • category_id — BIGINT — Foreign key → categories.id — NOT NULL
  • name — VARCHAR(200) — NOT NULL
  • description — TEXT
  • base_price — INT — NOT NULL
  • discount_rate — TINYINT — NOT NULL
  • sale_price — INT — NOT NULL
  • thumbnail_url — VARCHAR(500)
  • status — VARCHAR(20) — NOT NULL
  • like_count — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

stores

  • id — BIGINT — Primary key — NOT NULL
  • manager_id — BIGINT — Foreign key → users.id — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • description — TEXT
  • logo_url — VARCHAR(500)
  • status — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • approved_at — DATETIME
  • updated_at — DATETIME — NOT NULL

user_coupons

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • coupon_id — BIGINT — Foreign key → coupons.id — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • downloaded_at — DATETIME — NOT NULL
  • used_at — DATETIME

users

  • id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(100) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • nickname — VARCHAR(20) — NOT NULL
  • role — VARCHAR(20) — NOT NULL
  • grade — VARCHAR(10) — NOT NULL
  • total_purchase_amount — INT — NOT NULL
  • point_balance — INT — NOT NULL
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL