테이블 설계 방식
- JPA를 사용하기 때문에 처음에는 JPA의
ddl-auto
기능을 이용하여 구현함
- 구체적인 개발을 진행하면서, 최대값,
unique
,nullable
등 주요 제약사항을 추가함 - 데일리 스크럼 시간을 특히 이용
- 일정 이상 개발이 진행된 이후
schema.sql
파일 이용하여 테이블 규정, 이 시점에서ddl-auto
사용 중지
사전 준비해온 ERD
커뮤니티
민성(이미지 백업)
erDiagram card_collection ||--|{ card : have card_collection { bigint id PK bigint author_id FK int visit_count int scrap_count int residence int space int size int style int color boolean self string total_keywords } card { bigint collection_id FK string content int order string image_url string keywords }
한빈
- 집들이
- 고려할만한 사안
@아이디
형태의 태그 구현- 연결 테이블을 이용해
@ManyToMany
로 풀면 어떨지?
- 팔로잉
- 재귀적 다대다 관계의 중간 테이블
erDiagram COMMON { TIMESTAMP created_time TIMESTAMP modified_time } USER ||--o{ POST : have USER ||--o{ COMMENT : have USER ||--o{ FOLLOW : have USER { Long user_id PK VARCHAR nickname } FOLLOW { Long user_id PK Long target_id FK } POST ||--o{ COMMENT : have POST { Long post_id PK Long user_id FK "user_id of the USER" VARCHAR home_type INT home_size VARCHAR family_type VARCHAR city VARCHAR style INT budget VARCHAR title CLOB contents INT shared_times } COMMENT ||--o{ COMMENT : have COMMENT { Long comment_id PK Long user_id FK Long post_id FK Long parent_post_id FK "상위 댓글의 post_id" VARCHAR comment }
- card_collection: 그림 관련
- 사진 고유 id, 위치
- 해시태그 처리 문제
- 카테고리는 redis 캐시에 저장
커머스
훈기

민재

회원
현정
커뮤니티

커머스

대댓글을 구현할 것인지?
카테고리의 정도
포스트 테이블을 나누는 정도
통합 ERD
커뮤니티 파트
- 다이어그램
erDiagram base_entity { LocalDateTime created_at LocalDateTime updated_at } users ||--o{ follow: have users { bigint id PK varchar nickname varchar email varchar address varchar profile_image bigint following_count bigint follower_count } follow { bigint id PK bigint following_user_id FK bigint follower_user_id FK } users ||--o{ question : have question { bigint id PK bigint author_id FK varchar content int count } question ||--o{ question_image : have question_image { bigint id PK bigint question_id FK varchar image_url bigint order } users ||--o{ question_comment : have question ||--o{ question_comment : have question_comment { bigint id PK bigint author_id FK bigint question_id FK varchar content } users ||--o{ question_comment_reply : have question_comment ||--O{ question_comment_reply : have question_comment_reply { bigint id PK bigint author_id FK bigint comment_id FK varchar content } question ||--o{ question_keyword : have question_keyword { bigint id PK varchar name varchar category } question ||--o{ q_qk_link : have question_keyword ||--o{ q_qk_link : have q_qk_link { bigint id PK bigint question_id FK bigint keyword_id FK } users ||--o{ post : have post ||--o{ post_image : have post ||--o{ post_comment : have post_comment ||--o{ post_comment_reply : have post { bigint id PK bigint user_id FK varchar title varchar content int visit_count int scrap_count bigint writer bigint residence bigint area bigint budget bigint family bigint style bigint color_main bigint color_wall bigint color_floor bigint construction bigint expertise bigint agent } post_image { bigint id PK bigint post_id FK varchar url bigint order } post_comment { bigint id PK bigint post_id FK bigint author_id FK varchar title varchar content } post_comment_reply { bigint id PK bigint post_comment_id FK bigint author_id FK varchar title varchar content } user ||--o{ scrap_post : have post ||--o{ scrap_post : have scrap_post { bigint id PK bigint user_id FK bigint post_id FK }
- 내용
커머스
- 다이어그램
erDiagram users ||--o{ review: have users ||--o{ product: have users ||--o{ question: have users ||--|| cart: have users { bigint id PK } review { bigint id PK bigint product_id FK bigint user_id FK int durability_point int price_point int design_poin int shipping_point varchar contents int help_point } question { bigint id PK bigint product_id FK bigint user_id FK varchar purchase_status varchar contents } seller { bigint id PK bigint user_id FK varchar seller_name } product ||--o{ review: have product ||--o{ question: have product ||--|{ order_item: have product ||--|{ cart_product: have product { bigint id PK bigint category_id FK bigint attribute_id FK varchar name bigint price varchar contents int views } attribute ||--|{ product: have attribute { bigint id PK varchar color varchar size varchar brand varchar shipping } category ||--|{ product: have category { bigint id PK varchar root_category varchar second_category varchar third_category varchar fourth_category } delivery { bigint id PK bigint order_id FK varchar delivery_status varchar address LocalDate delivery_date } orders ||--|| delivery: have orders ||--|{ order_item: have orders { bigint id PK bigint customer_id FK bigint total_price } cart_product { bigint id PK bigint cart_id FK bigint product_id FK } order_item { bigint id PK bigint order_id FK bigint product_id FK bigint cart_id FK bigint quantity bigint price } cart ||--o{ cart_item: have cart { bigint id PK varchar user_id FK } item_scrap { bigint id PK bigint user_id bigint product_id } category |o--o{ category: have category { bigint id PK bigint parent_id FK } review_image { }
- 내용
통합 버전
- 다이어그램
erDiagram base_entity { LocalDateTime created_at LocalDateTime updated_at } users ||--o{ follow: have users ||--o{ review: have users ||--o{ product: have users ||--o{ question: have users ||--|| cart: have users { bigint id PK varchar nickname varchar email varchar address varchar profile_image bigint following_count bigint follower_count } follow { bigint id PK bigint following_user_id FK bigint follower_user_id FK } users ||--o{ question : have question { bigint id PK bigint author_id FK varchar content int count } question ||--o{ question_image : have question_image { bigint id PK bigint question_id FK varchar image_url bigint order } users ||--o{ question_comment : have question ||--o{ question_comment : have question_comment { bigint id PK bigint author_id FK bigint question_id FK varchar content } users ||--o{ question_comment_reply : have question_comment ||--O{ question_comment_reply : have question_comment_reply { bigint id PK bigint author_id FK varchar content } question ||--o{ question_keyword : have question_keyword { bigint id PK varchar name varchar category } question ||--o{ q_qk_link : have question_keyword ||--o{ q_qk_link : have q_qk_link { bigint id PK bigint question_id FK bigint keyword_id FK } users ||--o{ post : have post ||--o{ post_image : have post ||--o{ post_comment : have post { bigint id PK bigint user_id FK varchar title varchar content int visit_count int scrap_count bigint writer bigint residence bigint area bigint budget bigint family bigint style bigint color_main bigint color_wall bigint color_floor bigint construction bigint expertise bigint agent } post_image { bigint id PK bigint post_id FK varchar url bigint order } post_comment { bigint id PK bigint post_id FK bigint author_id FK varchar title varchar content } users ||--o{ scrap_post : have post ||--o{ scrap_post : have scrap_post { bigint id PK bigint user_id FK bigint post_id FK } review { bigint id PK bigint product_id FK bigint user_id FK int durability_point int price_point int design_poin int shipping_point varchar contents int help_point } question { bigint id PK bigint product_id FK bigint user_id FK varchar purchase_status varchar contents } seller { bigint id PK bigint user_id FK varchar seller_name } product ||--o{ review: have product ||--o{ question: have product ||--|{ order_item: have product ||--|{ cart_item: have product ||--|{ seller: have product { bigint id PK varchar name bigint price varchar contents } delivery { bigint id PK bigint order_id FK varchar delivery_status varchar address LocalDate delivery_date } orders ||--|| delivery: have orders ||--|{ order_item: have orders { bigint id PK bigint customer_id FK bigint total_price } cart_item { bigint id PK bigint cart_id FK bigint product_id FK } order_item { bigint id PK bigint order_id FK bigint product_id FK bigint cart_id FK bigint quantity bigint price } cart ||--o{ cart_item: have cart { bigint id PK varchar user_id FK } item_scrap { bigint id PK bigint user_id bigint product_id } category |o--o{ category: have category { bigint id PK bigint parent_id FK } review_image { }
- 설명