Skip to content

fix: host_university 테이블의 korean_name 필드에 unique key 추가#645

Open
whqtker wants to merge 2 commits intosolid-connection:developfrom
whqtker:fix/641-add-unique-constraint-to-host-university
Open

fix: host_university 테이블의 korean_name 필드에 unique key 추가#645
whqtker wants to merge 2 commits intosolid-connection:developfrom
whqtker:fix/641-add-unique-constraint-to-host-university

Conversation

@whqtker
Copy link
Member

@whqtker whqtker commented Feb 4, 2026

관련 이슈

작업 내용

같은 값을 가지는 korean_name 은 사실상 없기에 UK를 설정합니다.
기존 homeUniversityRepository 를 사용한 테스트 코드를 올바르게 동작하도록 수정했습니다. 이전에는 중복 이름이 생성 가능했으나, 해당 변경으로 인해 불가능해졌고, test용 repository를 생성하고 이를 사용하도록 변경했습니다.

특이 사항

리뷰 요구사항 (선택)

@whqtker whqtker self-assigned this Feb 4, 2026
@whqtker whqtker added the 버그 Something isn't working label Feb 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Walkthrough

1.  Java 엔티티 업데이트.
  HostUniversity의 koreanName 필드에 JPA @Column(nullable = false, unique = true, length = 100)를 적용했습니다.
2.  DB 마이그레이션 추가.
  V44__add_unique_constraint_to_host_university_korean_name.sqlhost_university(korean_name)uk_host_university_korean_name 유니크 제약을 생성했습니다.
3.  테스트 픽스처 변경.
  UniversityFixture의 빌더 호출들을 .create()에서 .findOrCreate()로 변경했습니다.
4.  테스트 전용 리포지토리 및 빌더 수정.
  HostUniversityRepositoryForTest 인터페이스를 추가했고 UniversityFixtureBuilder가 이를 사용하도록 생성자와 저장/조회 로직을 갱신했습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • wibaek
  • Hexeong
  • lsy1307
  • Gyuhyeok99
  • JAEHEE25
  • sukangpunch
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 PR의 핵심 변경사항인 host_university 테이블의 korean_name 필드에 unique key 추가를 명확하게 설명합니다.
Description check ✅ Passed PR 설명이 관련 이슈, 작업 내용, 테스트 코드 수정 사항을 포함하여 충분히 완성되어 있습니다.
Linked Issues check ✅ Passed 모든 요구사항이 충족되었습니다: DDL 작성(V44 마이그레이션 파일), 엔티티 수정(HostUniversity.koreanName에 unique=true 추가), 테스트 코드 수정이 완료되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 issue #641의 unique constraint 추가라는 범위 내에 있으며, 필요한 테스트 인프라 수정만 포함되어 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@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: 1

🤖 Fix all issues with AI agents
In
`@src/main/resources/db/migration/V44__add_unique_constraint_to_host_university_korean_name.sql`:
- Around line 1-2: The migration ADD CONSTRAINT uk_host_university_korean_name
on table host_university will fail if duplicate korean_name values exist; add a
cleanup migration that finds and resolves duplicates in
host_university.korean_name (either delete/merge duplicate rows or keep the
desired row and remove others) before applying the UNIQUE constraint, and
include a pre-deployment duplicate-check SQL query (e.g., SELECT korean_name,
COUNT(*) FROM host_university GROUP BY korean_name HAVING COUNT(*)>1) plus a
brief documented procedure for manual review/merge so the ALTER TABLE in
V44__add_unique_constraint_to_host_university_korean_name.sql succeeds reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

버그 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: host_university 필드에 unique 제약 조건 추가

1 participant