커뮤니티 DB 설계

테이블 (7)

Comments (Untitled3)

  • id (Key) — 기본 키 — NOT NULL
  • user_id (Key2) — INT — 외래 키 → Users.id — NOT NULL
  • post_id (Key3) — INT — 외래 키 → Posts.id — NOT NULL
  • content (Field) — TEXT

Files (Untitled6)

  • id (Key) — INT — 기본 키 — NOT NULL
  • url (Field) — TEXT — NOT NULL
  • is_committed (Field2) — BOOLEAN — NOT NULL
  • uploaded_user_id (Key2) — INT — 외래 키 → Users.id — NOT NULL
  • content_type (Field4) — VARCHAR(100)
  • created_at (Field5) — TIMESTAMP — NOT NULL
  • deleted_at (Field6) — TIMESTAMP

Likes (Untitled4)

  • id (Key2) — INT — 기본 키 — NOT NULL
  • created_at (Field)
  • user_id (Key3) — int — 외래 키 → Users.id — NOT NULL
  • post_id (Key) — int — 외래 키 → Posts.id — NOT NULL

Post_stats (Untitled5)

  • post_id (Key) — INT — 외래 키 → Posts.id — NOT NULL
  • like_count (Field) — BIGINT
  • view_count (Field2) — BIGINT
  • reply_count (Field3) — BIGINT

Posts (Untitled2)

  • id (Key) — INT — 기본 키 — NOT NULL
  • user_id (Key3) — INT — 외래 키 → Users.id — NOT NULL
  • title (Field) — VARCHAR(100) — NOT NULL
  • content (Field2) — LONGTEXT
  • updated_at (Field3) — TIMESTAMP — NOT NULL
  • created_at (Field4) — TIMESTAMP — NOT NULL
  • is_deleted (Field6) — BOOLEAN

Posts_Files (Untitled7)

  • post_id (Key) — int — 외래 키 → Posts.id — NOT NULL
  • file_id (Key2) — INT — 외래 키 → Files.id — NOT NULL

Users (Untitled)

  • id (Key) — INT — 기본 키 — NOT NULL
  • email (Field) — VARCHAR(255) — NOT NULL
  • nickname (Field3) — VARCHAR(50) — NOT NULL
  • updated_at (Field4) — TIMESTAMP — NOT NULL
  • created_at (Field5) — TIMESTAMP — NOT NULL
  • image_file_id (Key2) — INT — 외래 키 → Files.id
  • is_active (Field2) — BOOL — NOT NULL
  • is_admin (Field6) — BOOL — NOT NULL
  • last_login_at (Field7) — TIMESTAMP
  • is_deleted (Field8) — BOOLEAN — NOT NULL
  • deleted_at (Field9) — TIMESTAMP