reserve

Tables (13)

categories

  • id — INT — Primary key — NOT NULL
  • parent_id — INT — Foreign key → categories.id
  • name — VARCHAR(30) — NOT NULL
  • sort_order — TINYINT — NOT NULL
  • INDEX — idx_categories_parent

chat_messages

  • id — BIGINT — Primary key — NOT NULL
  • room_id — BIGINT — Foreign key → chat_rooms.id — NOT NULL
  • sender_id — BIGINT — Foreign key → users.id — NOT NULL
  • type — VARCHAR(20) — NOT NULL
  • content — TEXT — NOT NULL
  • metadata — JSON
  • is_read — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_messages_room
  • INDEX — idx_messages_unread

chat_rooms

  • id — BIGINT — Primary key — NOT NULL
  • item_id — BIGINT — Foreign key → items.id — NOT NULL
  • buyer_id — BIGINT — Foreign key → users.id — NOT NULL
  • seller_id — BIGINT — Foreign key → users.id — NOT NULL
  • last_message — VARCHAR(200)
  • last_message_at — DATETIME
  • buyer_unread — INT — NOT NULL
  • seller_unread — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • INDEX — idx_chatrooms_buyer
  • INDEX — idx_chatrooms_seller

item_images

  • id — BIGINT — Primary key — NOT NULL
  • item_id — BIGINT — Foreign key → items.id — NOT NULL
  • image_url — VARCHAR(500) — NOT NULL
  • s3_key — VARCHAR(300) — NOT NULL
  • sort_order — TINYINT — NOT NULL
  • is_thumbnail — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_item_images_item

items

  • id — BIGINT — Primary key — NOT NULL
  • seller_id — BIGINT — Foreign key → users.id — NOT NULL
  • category_id — INT — Foreign key → categories.id — NOT NULL
  • title — VARCHAR(100) — NOT NULL
  • description — TEXT — NOT NULL
  • price — INT — NOT NULL
  • trade_type — VARCHAR(10) — NOT NULL
  • status — VARCHAR(10) — NOT NULL
  • view_count — INT — NOT NULL
  • wish_count — INT — NOT NULL
  • boosted_at — DATETIME
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • deleted_at — DATETIME
  • INDEX — idx_items_status_created
  • INDEX — idx_items_category_status
  • INDEX — idx_items_seller
  • INDEX — idx_items_boosted
  • INDEX — idx_items_price
  • INDEX — idx_items_wish_count
  • FULLTEXT — INDEX

notifications

  • id — BIGINT — Primary key — NOT NULL
  • receiver_id — BIGINT — Foreign key → users.id — NOT NULL
  • type — VARCHAR(30) — NOT NULL
  • title — VARCHAR(100) — NOT NULL
  • content — VARCHAR(200) — NOT NULL
  • link_url — VARCHAR(300)
  • is_read — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_noti_receiver
  • INDEX — idx_noti_created

reports

  • id — BIGINT — Primary key — NOT NULL
  • reporter_id — BIGINT — Foreign key → users.id — NOT NULL
  • target_type — VARCHAR(10) — NOT NULL
  • target_id — BIGINT — NOT NULL
  • reason — VARCHAR(20) — NOT NULL
  • content — TEXT
  • status — VARCHAR(10) — NOT NULL
  • admin_note — TEXT
  • processed_by — BIGINT — Foreign key → users.id
  • processed_at — DATETIME
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_reports_status
  • INDEX — idx_reports_target
  • INDEX — idx_reports_reporter

reservations

  • id — BIGINT — Primary key — NOT NULL
  • trade_id — BIGINT — Foreign key → trades.id — NOT NULL
  • slot_id — BIGINT — Foreign key → time_slots.id — NOT NULL
  • buyer_id — BIGINT — Foreign key → users.id — NOT NULL
  • seller_id — BIGINT — Foreign key → users.id — NOT NULL
  • status — VARCHAR(10) — NOT NULL
  • confirmed_slot_id — BIGINT
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • INDEX — idx_reservations_trade
  • INDEX — idx_reservations_buyer
  • INDEX — idx_reservations_seller

reviews

  • id — BIGINT — Primary key — NOT NULL
  • trade_id — BIGINT — Foreign key → trades.id — NOT NULL
  • reviewer_id — BIGINT — Foreign key → users.id — NOT NULL
  • reviewee_id — BIGINT — Foreign key → users.id — NOT NULL
  • rating — TINYINT — NOT NULL
  • content — TEXT
  • reply — TEXT
  • replied_at — DATETIME
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • INDEX — idx_reviews_reviewee
  • INDEX — idx_reviews_reviewer

time_slots

  • id — BIGINT — Primary key — NOT NULL
  • seller_id — BIGINT — Foreign key → users.id — NOT NULL
  • started_at — DATETIME — NOT NULL
  • ended_at — DATETIME — NOT NULL
  • status — VARCHAR(10) — NOT NULL
  • version — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_slots_seller_time
  • INDEX — idx_slots_status

trades

  • id — BIGINT — Primary key — NOT NULL
  • item_id — BIGINT — Foreign key → items.id — NOT NULL
  • buyer_id — BIGINT — Foreign key → users.id — NOT NULL
  • seller_id — BIGINT — Foreign key → users.id — NOT NULL
  • status — VARCHAR(15) — NOT NULL
  • request_message — VARCHAR(500)
  • cancel_reason — VARCHAR(300)
  • buyer_confirmed — TINYINT(1) — NOT NULL
  • seller_confirmed — TINYINT(1) — NOT NULL
  • version — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • INDEX — idx_trades_buyer
  • INDEX — idx_trades_seller
  • INDEX — idx_trades_item

users

  • id — BIGINT — Primary key — NOT NULL
  • email — VARCHAR(255) — NOT NULL
  • password — VARCHAR(255)
  • nickname — VARCHAR(30) — NOT NULL
  • profile_image_url — VARCHAR(500)
  • bio — VARCHAR(200)
  • trust_score — INT — NOT NULL
  • grade — VARCHAR(10) — NOT NULL
  • role — VARCHAR(10) — NOT NULL
  • provider — VARCHAR(10) — NOT NULL
  • provider_id — VARCHAR(255)
  • status — VARCHAR(15) — NOT NULL
  • suspended_until — DATETIME
  • email_verified — TINYINT(1) — NOT NULL
  • last_boosted_at — DATETIME
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL
  • deleted_at — DATETIME
  • INDEX — idx_users_status
  • INDEX — idx_users_provider

wishlists

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • item_id — BIGINT — Foreign key → items.id — NOT NULL
  • created_at — DATETIME — NOT NULL
  • INDEX — idx_wishlists_item