Skip to content

Conversation

@whqtker
Copy link
Member

@whqtker whqtker commented Jan 24, 2026

관련 이슈

작업 내용

이전에 home_universityhost_university 와 잘못 연관관계 설정되었던 부분을 수정했습니다.

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

  1. HostUniversity 엔티티에서 homeUniversity 필드를 제거했습니다.
  2. UnivApplyInfo 엔티티에 homeUniversityId 컬럼(@Column(name = "home_university_id"))을 추가했습니다.
  3. data.sql의 host_university INSERT 문에서 home_university_id 값을 제거해 시드 데이터 열 순서를 조정했습니다.
  4. Flyway 마이그레이션(V43)으로 host_university의 FK를 제거하고 university_info_for_applyhome_university_id 컬럼 및 FK를 추가했습니다.
  5. 테스트 픽스처들(UnivApplyInfoFixtureBuilder, UniversityFixtureBuilder)의 생성자 호출 인자가 변경되어 호출 위치들이 업데이트되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • wibaek
  • Hexeong
  • JAEHEE25
  • lsy1307
  • sukangpunch
  • Gyuhyeok99
🚥 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
Title check ✅ Passed PR 제목이 변경 사항의 주요 내용을 명확하게 반영하고 있으며, 데이터 모델의 테이블 간 연관 관계 재설정이라는 핵심 변경사항을 잘 설명합니다.
Description check ✅ Passed PR 설명이 기본 구조를 따르고 있으며, 관련 이슈 및 작업 내용이 작성되어 있으나 특이 사항과 리뷰 요구사항 섹션이 비어 있습니다.
Linked Issues check ✅ Passed PR의 모든 코드 변경사항이 issue #621의 목표인 home_university와 univ_apply_for_info 간 연관 관계 재설정 요구사항을 충족하고 있습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 home_university FK를 host_university에서 university_info_for_apply로 이동시키는 범위 내에 있으며, 관련 엔티티, 마이그레이션, 테스트 픽스처가 일관되게 업데이트되어 있습니다.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@whqtker whqtker changed the title refactor: home_university와 university_info_for_apply가 FK 관계를 가지도록 refactor: 잘못 설정되었던 테이블 간 연관 관계 재설정 Jan 24, 2026
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/resources/data.sql (1)

151-226: 2) university_info_for_apply 시드에 home_university_id가 비어 있습니다.

  • 새 FK 관계를 테스트/개발 환경에서 검증하려면 시드에 home_university_id 값이 필요할 수 있습니다.
  • 의도적으로 NULL 유지라면 괜찮지만, 관계 사용 코드가 있다면 시드 보완을 권장합니다.
src/main/java/com/example/solidconnection/university/domain/UnivApplyInfo.java (1)

24-27: @EqualsAndHashCode의 callSuper를 명시적으로 지정해주세요.

BaseEntity를 상속받은 클래스이기 때문에 CI 경고가 발생하고 있습니다. 의도를 명확히 하기 위해 callSuper 값을 명시적으로 지정해 경고를 해결하세요.

  1. @EqualsAndHashCode 주석 수정
    • 현재: @EqualsAndHashCode(of = "id")
    • 변경: @EqualsAndHashCode(of = "id", callSuper = false)
    • 이유: id만으로 엔티티의 동등성을 정의하고, 부모 클래스의 감시 필드(createdAt, updatedAt)는 제외합니다.
🔧 제안 수정
-@EqualsAndHashCode(of = "id")
+@EqualsAndHashCode(of = "id", callSuper = false)
🤖 Fix all issues with AI agents
In
`@src/main/resources/db/migration/V43__move_home_university_fk_to_univ_apply_info.sql`:
- Around line 1-12: The migration drops fk_host_university_home_university and
host_university.home_university_id without backfilling, which will lose data;
instead: add the new nullable column
university_info_for_apply.home_university_id, copy values from
host_university.home_university_id into university_info_for_apply (using the
appropriate join on the linking key between host_university and
university_info_for_apply), then add the new FK
fk_university_info_for_apply_home_university, verify data, and only after
successful backfill drop the old foreign key fk_host_university_home_university
and drop host_university.home_university_id; ensure the copy handles NULLs and
preserves referential integrity before removing the original constraint.

Comment on lines +1 to +12
ALTER TABLE host_university
DROP FOREIGN KEY fk_host_university_home_university;

ALTER TABLE host_university
DROP COLUMN home_university_id;

ALTER TABLE university_info_for_apply
ADD COLUMN home_university_id BIGINT NULL;

ALTER TABLE university_info_for_apply
ADD CONSTRAINT fk_university_info_for_apply_home_university
FOREIGN KEY (home_university_id) REFERENCES home_university (id) ON DELETE NO ACTION;
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

1) 데이터 이관 없이 컬럼을 드롭하면 기존 관계가 소실됩니다.

  • 현재 스크립트는 기존 home_university_id 값을 백필하지 않고 컬럼을 제거합니다.
  • 운영 데이터가 있다면 FK 이동 과정에서 값이 유실됩니다.
🛠️ 안전한 순서 예시
-ALTER TABLE host_university
-    DROP FOREIGN KEY fk_host_university_home_university;
-
-ALTER TABLE host_university
-    DROP COLUMN home_university_id;
-
-ALTER TABLE university_info_for_apply
-    ADD COLUMN home_university_id BIGINT NULL;
-
-ALTER TABLE university_info_for_apply
-    ADD CONSTRAINT fk_university_info_for_apply_home_university
-        FOREIGN KEY (home_university_id) REFERENCES home_university (id) ON DELETE NO ACTION;
+ALTER TABLE university_info_for_apply
+    ADD COLUMN home_university_id BIGINT NULL;
+
+UPDATE university_info_for_apply u
+JOIN host_university h ON u.university_id = h.id
+SET u.home_university_id = h.home_university_id;
+
+ALTER TABLE university_info_for_apply
+    ADD CONSTRAINT fk_university_info_for_apply_home_university
+        FOREIGN KEY (home_university_id) REFERENCES home_university (id) ON DELETE NO ACTION;
+
+ALTER TABLE host_university
+    DROP FOREIGN KEY fk_host_university_home_university;
+
+ALTER TABLE host_university
+    DROP COLUMN home_university_id;
🤖 Prompt for AI Agents
In
`@src/main/resources/db/migration/V43__move_home_university_fk_to_univ_apply_info.sql`
around lines 1 - 12, The migration drops fk_host_university_home_university and
host_university.home_university_id without backfilling, which will lose data;
instead: add the new nullable column
university_info_for_apply.home_university_id, copy values from
host_university.home_university_id into university_info_for_apply (using the
appropriate join on the linking key between host_university and
university_info_for_apply), then add the new FK
fk_university_info_for_apply_home_university, verify data, and only after
successful backfill drop the old foreign key fk_host_university_home_university
and drop host_university.home_university_id; ensure the copy handles NULLs and
preserves referential integrity before removing the original constraint.

@whqtker whqtker merged commit 949d3d9 into solid-connection:develop Jan 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: home_university은 univ_apply_for_info 와 연관 관계를 맺도록

1 participant