[Toy Project] ERD 작성

이신영·2023년 4월 10일
0

Eternal Moments

목록 보기
2/14
post-thumbnail

프로젝트를 위한 ERD를 작성해보자 😀 툴은 dbdiagram.io를 사용했으며, 도중에 변경될 수 있으니 해당 ERD링크 에서 참고하면된다.


ERD


(선정리 못하는편 😂)

Table "board" {
  "id" bigint [pk, not null, increment]
  "content" varchar(255) [default: NULL]
  "created_date" date [default: NULL]
  "title" varchar(255) [default: NULL]
  "view_count" int [not null]
  "writer" varchar(255) [default: NULL]
  "like_count" int [not null]
}


Table "member" {
  "id" bigint [pk, not null, increment]
  "username" varchar(45) [not null]
  "password" varchar(255) [not null]
  "nickname" varchar(45) [not null]
}


Table "boardlike" {
  "id" bigint [pk, not null]
  "member_id" bigint
  "board_id" bigint
}

Table "comment" {
  "id" bigint [pk, not null, increment]
  "content" varchar(255) [not null]
  "created_date" date [default: NULL]
  "writer" varchar(255) [not null]
  "board_id" bigint
}

Table "inquiry" {
  "id" bigint [pk, not null, increment]
  "title" varchar(255) [not null]
  "content" varchar(255) [not null]
  "created_date" date [default: NULL]
  "writer" varchar(255) [not null]
  "reply" varchar(255) [default: NULL]
  "reply_date" date [default: NULL]
  "member_id" bigint
}

Table "calendar" {
"id" bigint [pk, not null, increment]
"title" varchar(255) [not null]
"description" text
"start_date" date [not null]
"end_date" date [not null]
"created_at" timestamp [not null]
"updated_at" timestamp [not null]
"created_by" bigint [not null]
"updated_by" bigint [not null]
}

Table "photoshoot" {
"id" bigint [pk, not null, increment]
"title" varchar(255) [not null]
"description" varchar(255) [not null]
"location" varchar(255) [not null]
"date" date [not null]
"time" time [not null]
"max_participants" int [not null]
"current_participants" int [not null, default: 0]
}


Table "photoshoot_application" {
"id" bigint [pk, not null, increment]
"name" varchar(255) [not null]
"email" varchar(255) [not null]
"phone" varchar(255) [not null]
"message" varchar(255) [default: NULL]
"photoshoot_id" bigint
}

Ref: "board"."id" < "boardlike"."board_id"
Ref: "member"."id" < "boardlike"."member_id"
Ref: "board"."id" < "comment"."board_id"
Ref: "member"."id" < "inquiry"."member_id"
Ref: "calendar"."created_by" < "member"."id"
Ref: "calendar"."updated_by" < "member"."id"
Ref: "photoshoot"."id" < "photoshoot_application"."photoshoot_id"
Ref: "member"."id" < "photoshoot"."id"


테이블

  • board

    게시판의 글 정보를 저장하는 테이블
  • member

    회원 정보를 저장하는 테이블
  • boardlike

    게시글에 대한 좋아요를 저장하는 테이블
  • comment

    게시글에 대한 댓글정보를 저장하는 테이블
  • inquiry

    문의글 정보를 저장하는 테이블
  • calendar

    동아리 행사 달력 정보를 저장하는 테이블
  • photoshoot

    출사지 정보를 저장하는 테이블
  • photoshoot_application

    출사지 신청 정보를 저장하는 테이블

관계

1. board와 boardlike (1:N)

  • boardlike 테이블은 board 테이블의 좋아요 정보를 저장한다.
  • boardlike 테이블의 board_id 칼럼은 board테이블의 id 칼럼을 참조한다.

2. board와 comment (1:N)

  • comment 테이블은 board 테이블의 댓글정보를 저장한다.
  • comment 테이블의 board_id 칼럼은 board 테이블의 id 칼럼을 참조한다.

3. member와 inquiry (1:N)

  • inquiry 테이블은 member 테이블의 회원 문의 정보를 저장한다.
  • inquiry 테이블의 member_id 칼럼은 member 테이블의 id 칼럼을 참조한다.

4. member와 calendar (1:N)

  • calendar 테이블은 member 테이블의 동아리행사 일정 정보를 저장한다.
  • calendar 테이블의 create_byupdate_by 칼럼은 member 테이블의 id를 참조한다.

5. photoshoot과 photoshoot_application (1:N)

  • photoshoot_application 테이블은 photoshoot 테이블의 출사지 신청 정보를 저장한다.
  • photoshoot_application 테이블의 photoshoot_id 칼럼은 photoshoot 테이블의 id 칼럼을 참조한다.
profile
후회하지 않는 사람이 되자 🔥

0개의 댓글