final

Tables (12)

addresses

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • recipient — VARCHAR(50) — NOT NULL
  • phone — VARCHAR(20) — NOT NULL
  • address — VARCHAR(255) — NOT NULL
  • detail — VARCHAR(100)
  • is_default — TINYINT(1) — NOT NULL

cart_items

  • id — BIGINT — Primary key — NOT NULL
  • cart_id — BIGINT — Foreign key → carts.id — NOT NULL
  • product_id — BIGINT — Foreign key → products.id — NOT NULL
  • quantity — INT — NOT NULL

carts

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • updated_at — DATETIME — NOT NULL

categories

  • id — BIGINT — Primary key — NOT NULL
  • parent_id — BIGINT — Foreign key → categories.id
  • name — VARCHAR(50) — NOT NULL
  • sort_order — INT — 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
  • seller_id — BIGINT — Foreign key → sellers.id — NOT NULL
  • product_name — VARCHAR(200) — NOT NULL
  • unit_price — DECIMAL(12, 2) — NOT NULL
  • quantity — INT — NOT NULL

orders

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • address_id — BIGINT — Foreign key → addresses.id
  • total_amount — DECIMAL(12, 2) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • tracking_number — VARCHAR(50)
  • created_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
  • amount — DECIMAL(12, 2) — NOT NULL
  • method — VARCHAR(20) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • paid_at — DATETIME

products

  • id — BIGINT — Primary key — NOT NULL
  • seller_id — BIGINT — Foreign key → sellers.id — NOT NULL
  • category_id — BIGINT — Foreign key → categories.id
  • name — VARCHAR(200) — NOT NULL
  • price — DECIMAL(12, 2) — NOT NULL
  • stock — INT — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • description — TEXT
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

refunds

  • id — BIGINT — Primary key — NOT NULL
  • order_id — BIGINT — Foreign key → orders.id — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • reason — VARCHAR(50) — NOT NULL
  • description — TEXT
  • status — VARCHAR(20) — NOT NULL
  • requested_at — DATETIME — NOT NULL
  • processed_at — DATETIME

sellers

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • store_name — VARCHAR(100) — NOT NULL
  • biz_number — VARCHAR(20) — NOT NULL
  • bank_account — VARCHAR(50)
  • status — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL

settlements

  • id — BIGINT — Primary key — NOT NULL
  • seller_id — BIGINT — Foreign key → sellers.id — NOT NULL
  • amount — DECIMAL(12, 2) — NOT NULL
  • fee — DECIMAL(12, 2) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • period_start — DATE — NOT NULL
  • period_end — DATE — NOT NULL
  • requested_at — DATETIME — NOT NULL
  • completed_at — DATETIME

users

  • id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(100) — NOT NULL
  • password — VARCHAR(255) — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • phone — VARCHAR(20)
  • role — VARCHAR(20) — NOT NULL
  • created_at — DATETIME — NOT NULL