adf

Tables (15)

brands

  • brand_id — BIGINT
  • manager_id — BIGINT — Foreign key → users.user_id
  • brand_name — VARCHAR(50) — NOT NULL
  • status — ENUM('PENDING', 'ACTIVE', 'SUSPENDED')

coupons

  • id — BIGINT — Primary key — NOT NULL
  • issued_by — BIGINT — Foreign key — 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 — NOT NULL
  • label — VARCHAR(50)
  • recipient_name — VARCHAR(50) — NOT NULL
  • phone — VARCHAR(20) — NOT NULL
  • zip_code — VARCHAR(10) — NOT NULL
  • address1 — VARCHAR(200) — NOT NULL
  • address2 — VARCHAR(200)
  • is_default — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL

main_categories

  • id — BIGINT — Primary key — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • sort_order — INT — NOT NULL

order_items

  • id — BIGINT — Primary key — NOT NULL
  • order_id — BIGINT — Foreign key — NOT NULL
  • product_id — BIGINT — Foreign key — 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

  • order_id — VARCHAR(50)
  • user_id — BIGINT — Foreign key → users.user_id
  • total_amount — DECIMAL(12, 2) — NOT NULL
  • grade_discount_amount — DECIMAL(12, 2)
  • coupon_discount_amount — DECIMAL(12, 2)
  • point_usage_amount — INT
  • final_payment_amount — DECIMAL(12, 2) — NOT NULL
  • status — ENUM('READY', 'PAID', 'CANCELLED', 'SHIPPING', 'COMPLETED')
  • created_at — TIMESTAMP

payments

  • payment_id — BIGINT
  • order_id — VARCHAR(50) — Foreign key → orders.order_id
  • payment_key — VARCHAR(255)
  • method — VARCHAR(20)
  • status — VARCHAR(20)
  • paid_at — TIMESTAMP

point_histories

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key — NOT NULL
  • order_id — BIGINT — Foreign key
  • 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 — 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

  • product_id — BIGINT
  • brand_id — BIGINT — Foreign key → brands.brand_id
  • category_id — INT
  • name — VARCHAR(100) — NOT NULL
  • description — TEXT
  • base_price — DECIMAL(12, 2) — NOT NULL
  • discount_rate — INT
  • like_count — INT
  • created_at — TIMESTAMP

stores

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

sub_categories

  • id — BIGINT — Primary key — NOT NULL
  • main_category_id — BIGINT — Foreign key → main_categories.id — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • sort_order — INT — NOT NULL

user_coupons

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

user_grades

  • grade_id — INT
  • grade_name — VARCHAR(20) — NOT NULL
  • min_amount — DECIMAL(12, 2)
  • discount_rate — DECIMAL(5, 2) — NOT NULL

users

  • user_id — BIGINT
  • email — VARCHAR(100) — NOT NULL
  • password — VARCHAR(255) — NOT NULL
  • nickname — VARCHAR(20) — NOT NULL
  • role — ENUM('ADMIN', 'MANAGER', 'CUSTOMER')
  • grade_id — INT — Foreign key → user_grades.grade_id
  • total_points — INT
  • created_at — TIMESTAMP