Skip to content

feat: 브랜드 및 채널 브랜드 엔티티와 테이블을 추가 -> Dev#107

Merged
HanYoonSoo merged 2 commits intodevelopfrom
in-254-ppl-브랜드-표기-관련-테이블-생성
May 6, 2026

Hidden character warning

The head ref may contain hidden characters: "in-254-ppl-\ube0c\ub79c\ub4dc-\ud45c\uae30-\uad00\ub828-\ud14c\uc774\ube14-\uc0dd\uc131"
Merged

feat: 브랜드 및 채널 브랜드 엔티티와 테이블을 추가 -> Dev#107
HanYoonSoo merged 2 commits intodevelopfrom
in-254-ppl-브랜드-표기-관련-테이블-생성

Conversation

@HanYoonSoo
Copy link
Copy Markdown
Contributor

@HanYoonSoo HanYoonSoo commented May 5, 2026

Issue


comment

  1. 브랜드 테이블 생성
  2. 브랜드 별칭 테이블 생성
  3. 채널_브랜드 테이블 생성

Summary by CodeRabbit

  • 새로운 기능

    • 브랜드 관리 기능 추가
    • 브랜드 별칭 관리 기능 추가
    • 채널별 브랜드 연결 기능 추가
  • 데이터베이스

    • 브랜드·별칭·채널-브랜드 관련 테이블 및 제약조건(유니크/외래키) 추가
    • 성능을 위한 인덱스 추가

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58715fc6-454f-4a63-b10f-bf45fbc6ab09

📥 Commits

Reviewing files that changed from the base of the PR and between 1113819 and 5a033a9.

📒 Files selected for processing (1)
  • src/main/resources/db/migration/V20260505205437__create_table_channel_brand.sql

Walkthrough

브랜드 도메인 모델을 위한 세 개의 JPA 엔티티(Brand, BrandAlias, ChannelBrand)와 이에 대응하는 데이터베이스 마이그레이션(테이블 및 인덱스)이 추가되었습니다.

Changes

Brand Domain Entities & Schema

Layer / File(s) Summary
Data Shape (Entities)
src/main/java/com/example/inflace/domain/brand/domain/Brand.java, src/main/java/com/example/inflace/domain/brand/domain/BrandAlias.java, src/main/java/com/example/inflace/domain/channel/domain/ChannelBrand.java
Brand(id, name, name에 유니크 제약), BrandAlias(id, brand FK, alias, 복합 유니크 제약), ChannelBrand(id, channel FK, brand FK, matchedAlias, 유니크(channel_id, brand_id)) 엔티티가 추가됨.
Core Implementation / Factory
src/main/java/com/example/inflace/domain/channel/domain/ChannelBrand.java
ChannelBrandof(Channel channel, Brand brand, String matchedAlias) 정적 팩토리 메서드가 추가되어 인스턴스 생성 방식이 정의됨.
Database Schema (DDL)
src/main/resources/db/migration/V20260505204433__create_table_brand.sql, ...V20260505204848__create_table_brand_alias.sql, ...V20260505205437__create_table_channel_brand.sql
brand, brand_alias, channel_brand 테이블 생성 DDL이 추가됨(외래키 및 유니크 제약 포함).
Database Indexes
src/main/resources/db/migration/V20260505205249__create_index_brand_alias_column_brand_id.sql, src/main/resources/db/migration/V20260505205347__create_index_brand_alias_column_alias.sql
brand_alias 테이블의 brand_idalias 컬럼에 대한 인덱스 생성 SQL이 추가됨.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • JECT-Study/inflace-4th-server#107: 동일한 엔티티(Brand, BrandAlias, ChannelBrand)와 동일한 DB 마이그레이션을 추가하는 PR로 직접 관련됨.
  • JECT-Study/inflace-4th-server#21: Channel 엔티티 및 감사(BaseTimeEntity) 관련 변경이 포함되어 있어 ChannelBrand와 코드 수준 의존성이 있음.

Suggested labels

👨🏻‍💻backend

Suggested reviewers

  • youcastle03
  • HwangRock

Poem

🐰
새싹 같은 브랜드가 돋아나네
별칭들이 속삭여 길을 잇고
채널과 손잡아 이름을 남기고
고유한 약속이 질서를 지키니
데이터 창고에 봄이 오네 🌸

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 브랜드 및 채널 브랜드 엔티티와 테이블 추가라는 변경사항의 핵심을 명확하게 요약하고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch in-254-ppl-브랜드-표기-관련-테이블-생성

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/main/resources/db/migration/V20260505205249__create_index_brand_alias_column_brand_id.sql (1)

1-1: 💤 Low value

brand_id 단독 인덱스가 복합 유니크 제약의 인덱스와 중복됩니다.

PostgreSQL은 UNIQUE 제약을 정의할 때 해당 컬럼에 대한 유니크 인덱스를 자동으로 생성하며, 유니크 컬럼에 별도로 인덱스를 생성할 필요가 없습니다 — 그렇게 하면 자동 생성된 인덱스가 중복될 뿐입니다. uk_brand_alias UNIQUE (brand_id, alias)가 이미 brand_id를 선두 컬럼으로 하는 B-tree 인덱스를 생성하므로, brand_id만 필터링하는 쿼리도 해당 복합 인덱스로 처리할 수 있습니다. 이 마이그레이션은 불필요한 쓰기 오버헤드와 스토리지 사용을 추가합니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/resources/db/migration/V20260505205249__create_index_brand_alias_column_brand_id.sql`
at line 1, 이 마이그레이션은 복합 유니크 제약 uk_brand_alias (UNIQUE (brand_id, alias))가 이미
brand_id를 선두 컬럼으로 하는 인덱스를 생성하므로 별도 인덱스 idx_brand_alias_brand_id를 만들지 말고 해당
CREATE INDEX 문을 제거하거나 마이그레이션에서 조건부로 건너뛰도록 수정하세요; 구체적으로
V20260505205249__create_index_brand_alias_column_brand_id.sql에서 "CREATE INDEX IF
NOT EXISTS idx_brand_alias_brand_id ON brand_alias (brand_id);" 라인을 삭제하거나 유니크 제약
존재 여부를 확인한 뒤에만 인덱스를 생성하도록 변경하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/com/example/inflace/domain/brand/domain/Brand.java`:
- Around line 14-21: The Brand entity lacks a way to be created from outside its
package; add a protected no-args constructor and a public static factory to
construct instances with name. Specifically, annotate Brand with
`@NoArgsConstructor`(access = AccessLevel.PROTECTED) (or add a protected no-arg
constructor), add a private constructor that accepts String name (or use
`@AllArgsConstructor`(access = AccessLevel.PRIVATE)), and add a public static
Brand of(String name) factory that returns a new Brand with the name field set;
reference the Brand class, name field, and the of() factory in your changes.

In `@src/main/java/com/example/inflace/domain/brand/domain/BrandAlias.java`:
- Around line 6-22: Add a protected no-args constructor and a controlled
creation API for BrandAlias: annotate the BrandAlias class with
`@NoArgsConstructor`(access = AccessLevel.PROTECTED) (to match Brand and
ChannelBrand) and provide a public constructor or static factory method (e.g.,
BrandAlias.of(Brand brand, String alias) or a public BrandAlias(Brand brand,
String alias)) that sets the brand and alias fields on creation so service code
can instantiate valid instances; reference the BrandAlias class and its brand
and alias fields when making the changes.

In
`@src/main/resources/db/migration/V20260505205437__create_table_channel_brand.sql`:
- Line 10: The migration SQL is truncated at the UNIQUE constraint; fix the
CONSTRAINT uk_channel_brand line to reference the full column name and close the
DDL: change the fragment to CONSTRAINT uk_channel_brand UNIQUE (channel_id,
brand_id), then ensure the CREATE TABLE statement has its closing parenthesis
and a terminating semicolon so the table definition is complete and Flyway can
parse it.

---

Nitpick comments:
In
`@src/main/resources/db/migration/V20260505205249__create_index_brand_alias_column_brand_id.sql`:
- Line 1: 이 마이그레이션은 복합 유니크 제약 uk_brand_alias (UNIQUE (brand_id, alias))가 이미
brand_id를 선두 컬럼으로 하는 인덱스를 생성하므로 별도 인덱스 idx_brand_alias_brand_id를 만들지 말고 해당
CREATE INDEX 문을 제거하거나 마이그레이션에서 조건부로 건너뛰도록 수정하세요; 구체적으로
V20260505205249__create_index_brand_alias_column_brand_id.sql에서 "CREATE INDEX IF
NOT EXISTS idx_brand_alias_brand_id ON brand_alias (brand_id);" 라인을 삭제하거나 유니크 제약
존재 여부를 확인한 뒤에만 인덱스를 생성하도록 변경하세요.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2bcdf1ce-512e-419c-a1b0-75d1f6a7b381

📥 Commits

Reviewing files that changed from the base of the PR and between e3775db and 1113819.

📒 Files selected for processing (8)
  • src/main/java/com/example/inflace/domain/brand/domain/Brand.java
  • src/main/java/com/example/inflace/domain/brand/domain/BrandAlias.java
  • src/main/java/com/example/inflace/domain/channel/domain/ChannelBrand.java
  • src/main/resources/db/migration/V20260505204433__create_table_brand.sql
  • src/main/resources/db/migration/V20260505204848__create_table_brand_alias.sql
  • src/main/resources/db/migration/V20260505205249__create_index_brand_alias_column_brand_id.sql
  • src/main/resources/db/migration/V20260505205347__create_index_brand_alias_column_alias.sql
  • src/main/resources/db/migration/V20260505205437__create_table_channel_brand.sql

Comment on lines +14 to +21
public class Brand {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "name", nullable = false)
private String name;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Brand 인스턴스를 생성할 방법이 없습니다.

@NoArgsConstructor(access = AccessLevel.PROTECTED)와 setter가 없어, 서비스 레이어(다른 패키지)에서 name이 설정된 Brand를 생성할 수 없습니다. ChannelBrand는 이미 of() 정적 팩터리 메서드 패턴을 사용하고 있습니다.

🏭 정적 팩터리 메서드 추가 제안
 public class Brand {
     `@Id`
     `@GeneratedValue`(strategy = GenerationType.IDENTITY)
     private Long id;
 
     `@Column`(name = "name", nullable = false)
     private String name;
+
+    public static Brand of(String name) {
+        Brand brand = new Brand();
+        brand.name = name;
+        return brand;
+    }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public class Brand {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "name", nullable = false)
private String name;
}
public class Brand {
`@Id`
`@GeneratedValue`(strategy = GenerationType.IDENTITY)
private Long id;
`@Column`(name = "name", nullable = false)
private String name;
public static Brand of(String name) {
Brand brand = new Brand();
brand.name = name;
return brand;
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/example/inflace/domain/brand/domain/Brand.java` around
lines 14 - 21, The Brand entity lacks a way to be created from outside its
package; add a protected no-args constructor and a public static factory to
construct instances with name. Specifically, annotate Brand with
`@NoArgsConstructor`(access = AccessLevel.PROTECTED) (or add a protected no-arg
constructor), add a private constructor that accepts String name (or use
`@AllArgsConstructor`(access = AccessLevel.PRIVATE)), and add a public static
Brand of(String name) factory that returns a new Brand with the name field set;
reference the Brand class, name field, and the of() factory in your changes.

Comment on lines +6 to +22
@Entity
@Table(name = "brand_alias", uniqueConstraints = {
@UniqueConstraint(columnNames = {"brand_id", "alias"})
})
@Getter
public class BrandAlias {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "brand_id", nullable = false)
private Brand brand;

@Column(name = "alias", nullable = false)
private String alias;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

@NoArgsConstructor 접근 제한 누락 및 인스턴스 생성 방법 부재

두 가지 문제가 있습니다:

  1. @NoArgsConstructor가 없어 Java의 기본 public 생성자가 노출됩니다. Brand, ChannelBrand는 모두 @NoArgsConstructor(access = AccessLevel.PROTECTED)를 사용합니다.
  2. Brand와 동일하게, 서비스 레이어에서 brandalias가 설정된 인스턴스를 생성할 방법이 없습니다.
🏭 수정 제안
 import jakarta.persistence.*;
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
 `@Entity`
 `@Table`(name = "brand_alias", uniqueConstraints = {
         `@UniqueConstraint`(columnNames = {"brand_id", "alias"})
 })
 `@Getter`
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
 public class BrandAlias {
     `@Id`
     `@GeneratedValue`(strategy = GenerationType.IDENTITY)
     private Long id;
 
     `@ManyToOne`(fetch = FetchType.LAZY)
     `@JoinColumn`(name = "brand_id", nullable = false)
     private Brand brand;
 
     `@Column`(name = "alias", nullable = false)
     private String alias;
+
+    public static BrandAlias of(Brand brand, String alias) {
+        BrandAlias brandAlias = new BrandAlias();
+        brandAlias.brand = brand;
+        brandAlias.alias = alias;
+        return brandAlias;
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/example/inflace/domain/brand/domain/BrandAlias.java` around
lines 6 - 22, Add a protected no-args constructor and a controlled creation API
for BrandAlias: annotate the BrandAlias class with `@NoArgsConstructor`(access =
AccessLevel.PROTECTED) (to match Brand and ChannelBrand) and provide a public
constructor or static factory method (e.g., BrandAlias.of(Brand brand, String
alias) or a public BrandAlias(Brand brand, String alias)) that sets the brand
and alias fields on creation so service code can instantiate valid instances;
reference the BrandAlias class and its brand and alias fields when making the
changes.

Comment thread src/main/resources/db/migration/V20260505205437__create_table_channel_brand.sql Outdated
Copy link
Copy Markdown

@MINUUUUUUUUUUUU MINUUUUUUUUUUUU left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!

@HanYoonSoo HanYoonSoo merged commit a3050bc into develop May 6, 2026
2 of 3 checks passed
@HanYoonSoo HanYoonSoo deleted the in-254-ppl-브랜드-표기-관련-테이블-생성 branch May 6, 2026 01:00
@sunJ0120 sunJ0120 requested a review from MINUUUUUUUUUUUU May 6, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants