Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public class Restaurant extends BaseEntity {
@Column(name = "category", length = 50)
private String category;

@Column(name = "menu", length = 100)
private String menu;

@Column(name = "description", length = 255)
private String description;

@Column(name = "image_url", length = 500)
private String imageUrl;

@Column(name = "map_url", columnDefinition = "TEXT")
private String mapUrl;

@Column(name = "blog_url", columnDefinition = "TEXT")
private String blogUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public class RestaurantSection extends BaseEntity {
@Column(name = "title", nullable = false, length = 100)
private String title;

@Column(name = "menu", length = 100)
private String menu;

@Column(name = "description", length = 255)
private String description;

@Column(name = "map_url", columnDefinition = "TEXT")
private String mapUrl;

@Column(name = "blog_url", columnDefinition = "TEXT")
private String blogUrl;

Comment on lines +29 to +40

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

RestaurantSection 엔티티에 menu, description, mapUrl, blogUrl 필드를 추가하는 것은 데이터 모델링 관점에서 재검토가 필요합니다.

RestaurantSectionList<Restaurant>를 통해 여러 Restaurant를 포함하는 집합의 역할을 합니다. Restaurant 엔티티에도 동일한 필드가 존재하므로, RestaurantSection에 이 필드들을 추가하면 다음과 같은 문제가 발생할 수 있습니다.

  • 데이터 중복 및 불일치: 같은 정보가 두 테이블에 중복 저장될 수 있으며, 데이터 동기화가 되지 않으면 불일치가 발생할 위험이 있습니다.
  • 의미의 모호성: RestaurantSectionmenu가 무엇을 의미하는지 불분명합니다. (예: 섹션 내 모든 식당의 메뉴 요약? 대표 식당의 메뉴?)

이러한 필드들은 개별 식당의 고유한 속성이므로 Restaurant 엔티티에만 유지하는 것이 더 명확하고 유지보수하기 좋은 설계입니다.

따라서 RestaurantSection 엔티티와 V31 마이그레이션 파일에서 restaurant_sections 테이블에 컬럼을 추가하는 부분을 함께 제거하는 것을 권장합니다.

@OneToMany(mappedBy = "section", fetch = FetchType.LAZY)
@Builder.Default
private List<Restaurant> restaurants = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ALTER TABLE restaurants ADD COLUMN menu VARCHAR(100);
ALTER TABLE restaurants ADD COLUMN description VARCHAR(255);
ALTER TABLE restaurants ADD COLUMN map_url TEXT;
ALTER TABLE restaurants ADD COLUMN blog_url TEXT;

ALTER TABLE restaurant_sections ADD COLUMN menu VARCHAR(100);
ALTER TABLE restaurant_sections ADD COLUMN description VARCHAR(255);
ALTER TABLE restaurant_sections ADD COLUMN map_url TEXT;
ALTER TABLE restaurant_sections ADD COLUMN blog_url TEXT;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

파일의 마지막에 개행 문자(newline)가 없습니다. POSIX 표준에 따르면 텍스트 파일은 개행 문자로 끝나야 하며, 이를 따르는 것이 일반적인 컨벤션입니다. Git, cat 등 일부 도구는 마지막 줄에 개행 문자가 없을 경우 예기치 않게 동작할 수 있습니다. 파일 끝에 개행 문자를 추가해주세요.

Suggested change
ALTER TABLE restaurant_sections ADD COLUMN blog_url TEXT;
ALTER TABLE restaurant_sections ADD COLUMN blog_url TEXT;