Skip to content
Open
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 @@ -24,7 +24,7 @@ public class HostUniversity extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false, length = 100)
@Column(nullable = false, unique = true, length = 100)
private String koreanName;

@Column(nullable = false, length = 100)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE host_university
ADD CONSTRAINT uk_host_university_korean_name UNIQUE (korean_name);
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

중복 데이터가 있으면 마이그레이션이 실패합니다.
배포 전에 host_university.korean_name 중복을 정리하거나 정리 마이그레이션을 추가해 주세요.
운영 장애를 줄이기 위해 중복 여부를 사전에 점검하는 절차도 필요합니다.

    1. 중복 레코드 정리(삭제/병합) 마이그레이션 추가
    1. 배포 전 중복 점검 쿼리 및 정리 절차 문서화
🤖 Prompt for AI Agents
In
`@src/main/resources/db/migration/V44__add_unique_constraint_to_host_university_korean_name.sql`
around lines 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.

Loading