communtiy_ERD

Tables (6)

comments

  • comment_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • post_id — INT — Foreign key → posts.post_id — NOT NULL — FK → posts | NOT NULL
  • user_id — INT — Foreign key → users.user_id — NOT NULL — FK → users | NOT NULL
  • file_id — INT — Foreign key → post_files.file_id — FK → post_files | NULL
  • comment_content — TEXT — NOT NULL — NOT NULL
  • created_at — DATETIME — NOT NULL — NOT NULL
  • updated_at — DATETIME — NOT NULL — NOT NULL
  • deleted_at — DATETIME — NULL (soft delete)

post_files

  • file_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • file_path — VARCHAR(500) — NOT NULL — NOT NULL
  • created_at — DATETIME — NOT NULL — NOT NULL

post_likes

  • like_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • post_id — INT — Foreign key → posts.post_id — NOT NULL — FK → posts | NOT NULL
  • user_id — INT — Foreign key → users.user_id — NOT NULL — FK → users | NOT NULL
  • created_at — DATETIME — NOT NULL — NOT NULL

posts

  • post_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • user_id — INT — Foreign key → users.user_id — NOT NULL — FK → users | NOT NULL
  • file_id — INT — Foreign key → post_files.file_id — FK → post_files | NULL
  • post_title — VARCHAR(255) — NOT NULL — NOT NULL
  • post_content — TEXT — NOT NULL — NOT NULL
  • hits — INT — NOT NULL — NOT NULL | DEFAULT 0
  • created_at — DATETIME — NOT NULL — NOT NULL
  • updated_at — DATETIME — NOT NULL — NOT NULL
  • deleted_at — DATETIME — NULL (soft delete)

profile_images

  • profile_image_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • user_id — INT — Foreign key → users.user_id — NOT NULL — FK → users | NOT NULL
  • file_path — VARCHAR(500) — NOT NULL — NOT NULL
  • created_at — DATETIME — NOT NULL — NOT NULL

users

  • user_id — INT — Primary key — NOT NULL — PK | NOT NULL
  • email — VARCHAR(255) — NOT NULL — NOT NULL | UNIQUE
  • password — VARCHAR(255) — NOT NULL — NOT NULL
  • nickname — VARCHAR(50) — NOT NULL — NOT NULL | UNIQUE
  • created_at — DATETIME — NOT NULL — NOT NULL
  • updated_at — DATETIME — NOT NULL — NOT NULL
  • deleted_at — DATETIME — NULL (soft delete)