Shoppingmall

Tables (6)

Order

  • order_id (Key) — int — Primary key — NOT NULL
  • user_id (Key2) — VARCHAR(100) — Foreign key → user.user_id — NOT NULL
  • order_date — DATETIME — NOT NULL — 주문 날짜
  • total_price — INT — NOT NULL — 총 주문 금액
  • status — ENUM('PENDING', 'COMPLETED', 'CANCELED') — NOT NULL — 주문 상태

OrderItem

  • order_item_id — INT — Primary key — NOT NULL
  • order_id (Key) — int — Foreign key → Order.order_id — NOT NULL
  • user_id (Key2) — VARCHAR(100) — Foreign key → Order.user_id — NOT NULL
  • product_id — int — Foreign key → products.product_id — NOT NULL
  • quantity — INT — NOT NULL — 수량
  • subtotal_price — INT — NOT NULL — 소계 금액

cart

  • user_id (Key) — VARCHAR(100) — Foreign key → user.user_id — NOT NULL
  • id — INT
  • quantity — INT — NOT NULL
  • added_at — TIMESTAMP
  • product_id — int — Foreign key → products.product_id — NOT NULL

categories

  • category_id — int — Primary key
  • parent_category_id — int
  • category_name — varchar(50) — NOT NULL
  • depth — int — NOT NULL

products

  • product_id — int — Primary key — NOT NULL
  • product_name — varchar(100) — NOT NULL
  • price — int — NOT NULL
  • description — text
  • image_url — varchar(200)
  • stock — int — NOT NULL
  • created_at — timestamp
  • updated_at — timestamp
  • category_id — int — Foreign key → categories.category_id

user

  • user_id (Key) — VARCHAR(100) — Primary key — NOT NULL
  • user_name — VARCHAR(100) — NOT NULL — 사용자 이름
  • user_password — VARCHAR(255) — NOT NULL — 비밀번호 (해싱 저장)
  • user_birth — CHAR(8) — NOT NULL — 생년월일 (YYYYMMDD)
  • user_auth — ENUM('ROLE_ADMIN', 'ROLE_USER') — NOT NULL — 권한
  • user_point — INT — NOT NULL — 보유 포인트
  • created_at — DATETIME — NOT NULL — 가입일
  • latest_login_at — DATETIME — 최근 로그인 시간