도메인 테이블 설계

테이블 (18)

Category (categories)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • name (Field) — varchar(20)
  • created_at (Field2) — timestamp
  • updated_at (Field3) — timestamp

ChatRoom (chat_rooms)

  • id (Key) — string — 기본 키 — NOT NULL
  • product_id (Field) — bigint
  • product_image (Field2) — string
  • first_user_id (Field3) — bigint
  • second_user_id (Field4) — bigint
  • identifier (Field5) — string
  • chat_messages (Field6) — array
  • created_at (Field7) — timestamp
  • updated_at (Field8) — timestamp

Events

  • event_id — BIGINT
  • store_id — BIGINT — NOT NULL
  • title — VARCHAR(200) — NOT NULL
  • description — TEXT
  • start_date — DATE
  • end_date — DATE
  • created_at — DATETIME

FavoriteProduct (favorite_products)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • user_id (FK) — bigint — 외래 키 → User.id — NOT NULL
  • product_id (FK2) — bigint — 외래 키 → Product.Key — NOT NULL
  • is_valid (Field) — boolean
  • created_at (Field2) — timestamp
  • updated_at (Field3) — timestamp

Manner (manners)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • user_id (FK) — bigint — 외래 키 → User.id — NOT NULL
  • evaluator_id (FK3) — bigint — 외래 키 → User.id — NOT NULL
  • score (Field2) — int
  • created_at (Field3) — timestamp
  • updated_at (Field4) — timestamp

Messages

  • message_id — BIGINT
  • sender_id — BIGINT — NOT NULL
  • receiver_id — BIGINT — NOT NULL
  • content — TEXT
  • type — ENUM('reservation','system','manual')
  • created_at — DATETIME

Notification (notifications)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • user_id (FK) — bigint — 외래 키 → User.id — NOT NULL
  • notification_type (Field) — int
  • identifier (Field2) — varchar(50)
  • is_read (Field3) — boolean
  • is_valid (Field5) — boolean
  • created_at (Field4) — timestamp

Participant (participants)

  • id (Key) — string — 기본 키 — NOT NULL
  • chat_room_id (Key2) — string — 외래 키 → ChatRoom.id — NOT NULL
  • user_id (Field) — bigint
  • out (Field2) — boolean
  • read_message_size (Field3) — bigint
  • created_at (Field4) — timestamp
  • updated_at (Field5) — timestamp

Payments

  • payment_id — BIGINT
  • reservation_id — BIGINT — NOT NULL
  • amount — DECIMAL(10,2) — NOT NULL
  • method — ENUM('card','kakaopay','tosspayments') — NOT NULL
  • status — ENUM('paid','refunded','failed')
  • created_at — DATETIME

Product (products)

  • Key — bigint — 기본 키 — NOT NULL
  • seller_id (FK) — bigint — 외래 키 → User.id — NOT NULL
  • buyer_id (FK2) — bigint — 외래 키 → User.id — NOT NULL
  • category_id (FK3) — bigint — 외래 키 → Category.id — NOT NULL
  • price (Field2) — bigint
  • title (Field3) — varchar(100)
  • description (Field4) — varchar(100)
  • location (Field5) — varchar(20)
  • product_state (Field6) — int
  • thumb_nail_image (Field7) — varchar(250)
  • view_cnt (Field8) — int
  • refresh_cnt (Field9) — int
  • created_at (Field10) — timestamp
  • updated_at (Field11) — timestamp
  • refreshed_at (Field12) — timestamp

ProductImage (product_images)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • product_id (FK) — bigint — 외래 키 → Product.Key — NOT NULL
  • image_url (Field) — varchar(250)
  • created_at (Field2) — timestamp
  • updated_at (Field3) — timestamp

Reservations

  • reservation_id — BIGINT
  • user_id — BIGINT — NOT NULL
  • store_id — BIGINT — NOT NULL
  • reserved_at — DATETIME — NOT NULL
  • people_count — INT — NOT NULL
  • status — ENUM('pending','confirmed','cancelled','rejected','completed')
  • payment_status — ENUM('unpaid','paid','refunded')
  • created_at — DATETIME

Reviews

  • review_id — BIGINT
  • user_id — BIGINT — NOT NULL
  • store_id — BIGINT — NOT NULL
  • reservation_id — BIGINT — NOT NULL
  • rating — INT
  • content — TEXT
  • created_at — DATETIME
  • updated_at — DATETIME

SaleReview (sale_reviews)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • product_id (FK3) — bigint — 외래 키 → Product.Key — NOT NULL
  • reviewer_id (FK) — bigint — 외래 키 → User.id — NOT NULL
  • reviewee_id (FK2) — bigint — 외래 키 → User.id — NOT NULL
  • sale_review_type (Field4) — int
  • content (Field) — varchar(500)
  • created_at (Field2) — timestamp
  • updated_at (Field3) — timestamp

StoreLikes

  • like_id — BIGINT
  • user_id — BIGINT — NOT NULL
  • store_id — BIGINT — NOT NULL
  • created_at — DATETIME

Stores

  • store_id — BIGINT
  • owner_id — BIGINT — NOT NULL
  • name — VARCHAR(200) — NOT NULL
  • description — TEXT
  • phone — VARCHAR(20)
  • address — VARCHAR(255)
  • lat — DECIMAL(10,8)
  • lng — DECIMAL(11,8)
  • image_url — VARCHAR(255)
  • created_at — DATETIME
  • updated_at — DATETIME

User (users)

  • id (Key) — bigint — 기본 키 — NOT NULL
  • oauth_id (Field) — bigint
  • nickname (Field2) — varchar(20)
  • location (Field3) — varchar(20)
  • profile_url (Field4) — varchar(250)
  • manner (Field5) — double
  • created_at (Field6) — timestamp
  • updated_at (Field7) — timestamp

Users

  • user_id — BIGINT
  • role — ENUM('customer', 'store_owner', 'admin') — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • email — VARCHAR(150) — NOT NULL
  • password — VARCHAR(255) — NOT NULL
  • phone — VARCHAR(20)
  • social_type — ENUM('naver', 'kakao', 'google')
  • status — ENUM('active', 'inactive', 'blacklisted')
  • created_at — DATETIME
  • updated_at — DATETIME