ecommerce-msa

Tables (8)

addresses

  • id — BINARY(16) — Primary key — NOT NULL
  • user_id — BINARY(16) — Foreign key → users.id — NOT NULL
  • address_line1 — VARCHAR(255) — NOT NULL
  • address_line2 — VARCHAR(255)
  • city — VARCHAR(100)
  • state — VARCHAR(100)
  • postal_code — VARCHAR(20)
  • country — VARCHAR(50)
  • is_default — TINYINT(1)

categories

  • id — BINARY(16) — Primary key — NOT NULL
  • name — VARCHAR(100) — NOT NULL

order_items

  • id — BINARY(16) — Primary key — NOT NULL
  • order_id — BINARY(16) — Foreign key → orders.id — NOT NULL
  • product_id — BINARY(16) — NOT NULL
  • quantity — INT — NOT NULL
  • unit_price — DECIMAL(10,2) — NOT NULL

orders

  • id — BINARY(16) — Primary key — NOT NULL
  • user_id — BINARY(16) — NOT NULL
  • status — ENUM('pending','paid','shipped','cancelled','completed')
  • total_amount — DECIMAL(10,2) — NOT NULL
  • created_at — TIMESTAMP
  • updated_at — TIMESTAMP

payments

  • id — BINARY(16) — Primary key — NOT NULL
  • order_id — BINARY(16) — Foreign key → orders.id — NOT NULL
  • amount — DECIMAL(10,2) — NOT NULL
  • method — ENUM('card','bank_transfer','virtual_account','paypal','etc') — NOT NULL
  • status — ENUM('pending','success','failed')
  • transaction_id — VARCHAR(100)
  • created_at — TIMESTAMP

product_images

  • id — BINARY(16) — Primary key — NOT NULL
  • product_id — BINARY(16) — Foreign key → products.id — NOT NULL
  • image_url — VARCHAR(255) — NOT NULL

products

  • id — BINARY(16) — Primary key — NOT NULL
  • category_id — BINARY(16) — Foreign key → categories.id — NOT NULL
  • name — VARCHAR(150) — NOT NULL
  • description — TEXT
  • price — DECIMAL(10,2) — NOT NULL
  • stock_quantity — INT
  • created_at — TIMESTAMP
  • updated_at — TIMESTAMP

users

  • id — BINARY(16) — Primary key — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • email — VARCHAR(150) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • phone — VARCHAR(20)
  • created_at — TIMESTAMP — CURRENT_TIMESTAMP
  • updated_at — TIMESTAMP — CURRENT_TIMESTAMP