CabbegeMarket ERD

Tables (14)

category

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

chat_room

  • id — BIGINT — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → product.id — NOT NULL
  • buyer_id — BIGINT — Foreign key → user.id — NOT NULL
  • seller_id — BIGINT — Foreign key → user.id — NOT NULL
  • last_message_at — DATETIME
  • created_at — DATETIME — NOT NULL

coupon

  • id — BIGINT — Primary key — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • discount_type — ENUM('RATE','AMOUNT') — NOT NULL
  • discount_value — INT — NOT NULL
  • valid_until — DATETIME

follow

  • id — BIGINT — Primary key — NOT NULL
  • follower_id — BIGINT — Foreign key → user.id — NOT NULL
  • following_id — BIGINT — Foreign key → user.id — NOT NULL
  • created_at — DATETIME — NOT NULL

inquiry

  • id — BIGINT — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → product.id — NOT NULL
  • user_id — BIGINT — Foreign key → user.id — NOT NULL
  • parent_id — BIGINT — Foreign key → inquiry.id
  • content — TEXT — NOT NULL
  • created_at — DATETIME — NOT NULL

message

  • id — BIGINT — Primary key — NOT NULL
  • chat_room_id — BIGINT — Foreign key → chat_room.id — NOT NULL
  • sender_id — BIGINT — Foreign key → user.id — NOT NULL
  • content — TEXT — NOT NULL
  • is_read — BOOLEAN — NOT NULL
  • created_at — DATETIME — NOT NULL

product

  • id — BIGINT — Primary key — NOT NULL
  • seller_id — BIGINT — Foreign key → user.id — NOT NULL
  • category_id — BIGINT — Foreign key → category.id
  • title — VARCHAR(100) — NOT NULL
  • description — TEXT
  • price — INT — NOT NULL
  • condition — ENUM('NEW','USED') — NOT NULL
  • status — ENUM('DRAFT','ON_SALE','RESERVED','SOLD') — NOT NULL
  • view_count — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

product_image

  • id — BIGINT — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → product.id — NOT NULL
  • image_url — VARCHAR(500) — NOT NULL
  • is_thumbnail — BOOLEAN — NOT NULL
  • sort_order — INT — NOT NULL

product_like

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → user.id — NOT NULL
  • product_id — BIGINT — Foreign key → product.id — NOT NULL
  • created_at — DATETIME — NOT NULL

review

  • id — BIGINT — Primary key — NOT NULL
  • trade_id — BIGINT — Foreign key → trade.id — NOT NULL
  • reviewer_id — BIGINT — Foreign key → user.id — NOT NULL
  • reviewee_id — BIGINT — Foreign key → user.id — NOT NULL
  • rating — TINYINT — NOT NULL
  • content — TEXT
  • created_at — DATETIME — NOT NULL

search_keyword

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → user.id
  • keyword — VARCHAR(100) — NOT NULL
  • created_at — DATETIME — NOT NULL

trade

  • id — BIGINT — Primary key — NOT NULL
  • product_id — BIGINT — Foreign key → product.id — NOT NULL
  • buyer_id — BIGINT — Foreign key → user.id — NOT NULL
  • seller_id — BIGINT — Foreign key → user.id — NOT NULL
  • user_coupon_id — BIGINT — Foreign key → user_coupon.id
  • trade_method — ENUM('DIRECT','DELIVERY') — NOT NULL
  • product_amount — INT — NOT NULL
  • discount_amount — INT — NOT NULL
  • final_amount — INT — NOT NULL
  • status — ENUM('PENDING','PAID','COMPLETED','CANCELED') — NOT NULL
  • created_at — DATETIME — NOT NULL

user

  • id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(255) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • nickname — VARCHAR(50) — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • phone — VARCHAR(20) — NOT NULL
  • profile_image_url — VARCHAR(500)
  • rating_avg — DECIMAL(2,1) — NOT NULL
  • rating_count — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

user_coupon

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → user.id — NOT NULL
  • coupon_id — BIGINT — Foreign key → coupon.id — NOT NULL
  • is_used — BOOLEAN — NOT NULL
  • issued_at — DATETIME — NOT NULL
  • used_at — DATETIME