-
Notifications
You must be signed in to change notification settings - Fork 8
fix: flyway 스크립트 오타 수정 #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Gyuhyeok99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
Walkthrough
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🔭 Outside diff range comments (1)
src/main/resources/db/migration/V13__add_application_index_and_delete_manny_to_one_mapping.sql (1)
5-7: 기존 동일 명칭 인덱스 충돌 가능성
idx_app_user_term_delete인덱스가 이미 존재하면CREATE INDEX가 실패합니다.
CREATE INDEX IF NOT EXISTS …로 바꾸거나,- 혹은
DROP INDEX IF EXISTS …후 재생성을 권장합니다.-DROP INDEX IF EXISTS idx_app_user_term_delete; -- 필요 시 선행 -CREATE INDEX idx_app_user_term_delete - ON application(site_user_id, term, is_delete); +CREATE INDEX IF NOT EXISTS idx_app_user_term_delete + ON application(site_user_id, term, is_delete);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/resources/db/migration/V13__add_application_index_and_delete_manny_to_one_mapping.sql(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (1)
src/main/resources/db/migration/V13__add_application_index_and_delete_manny_to_one_mapping.sql (1)
1-3: 컬럼명 RENAME 시 FK·트리거 의존성 확인 필요
- 외래키·트리거·VIEW가 해당 컬럼을 참조하고 있다면
ALTER TABLE … RENAME COLUMN단계에서 에러가 납니다.
- 사전에
DROP CONSTRAINT …또는ALTER CONSTRAINT …패턴을 넣어 두었는지 재확인해 주세요.- Flyway 롤백 플랜이 없다면 Down 마이그레이션 작성도 검토해 주세요.
| CREATE INDEX idx_app_first_choice_search | ||
| ON application(verify_status, term, is_delete, first_choice_university_apply_info_id); | ||
| ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id); | ||
|
|
||
| CREATE INDEX idx_app_second_choice_search | ||
| ON application(verify_status, term, is_delete, second_choice_university_apply_info_id); | ||
| ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id); | ||
|
|
||
| CREATE INDEX idx_app_third_choice_search | ||
| ON application(verify_status, term, is_delete, third_choice_university_apply_info_id); | ||
| ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
중복 인덱스 + 자동 컬럼 추적 오해
- 컬럼 RENAME 시 기존 인덱스는 내부적으로 새 컬럼명을 자동 추적합니다. 따라서 동일 이름으로 다시
CREATE INDEX하면 충돌이 납니다. - 해결 옵션
① 기존 인덱스 재사용 → 본 구문(8–15라인) 자체를 제거.
② 재생성 필요 →DROP INDEX IF EXISTS후CREATE INDEX실행. CONCURRENTLY옵션을 사용하면 운영 중 락을 최소화할 수 있습니다(PostgreSQL 기준).
-DROP INDEX IF EXISTS idx_app_first_choice_search;
-DROP INDEX IF EXISTS idx_app_second_choice_search;
-DROP INDEX IF EXISTS idx_app_third_choice_search;
-
-CREATE INDEX idx_app_first_choice_search
- ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id);
-CREATE INDEX idx_app_second_choice_search
- ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id);
-CREATE INDEX idx_app_third_choice_search
- ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id);
+-- 기존 인덱스 제거 후 재생성(필요 시 CONCURRENTLY 사용)
+DROP INDEX IF EXISTS idx_app_first_choice_search;
+CREATE INDEX idx_app_first_choice_search
+ ON application(verify_status, term, is_delete, first_choice_university_info_for_apply_id);
+
+DROP INDEX IF EXISTS idx_app_second_choice_search;
+CREATE INDEX idx_app_second_choice_search
+ ON application(verify_status, term, is_delete, second_choice_university_info_for_apply_id);
+
+DROP INDEX IF EXISTS idx_app_third_choice_search;
+CREATE INDEX idx_app_third_choice_search
+ ON application(verify_status, term, is_delete, third_choice_university_info_for_apply_id);Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In
src/main/resources/db/migration/V13__add_application_index_and_delete_manny_to_one_mapping.sql
lines 8 to 15, the script attempts to create indexes that likely already exist
due to column renaming automatically updating index definitions, causing
conflicts. To fix this, either remove these CREATE INDEX statements entirely to
reuse existing indexes or modify the script to first drop the indexes if they
exist using DROP INDEX IF EXISTS, then recreate them with CREATE INDEX
CONCURRENTLY to minimize locking during operation.
파일 이름이
V13_xxxx로 되어있던 것을V13__xxxx로 수정합니다.(flyway 스크립트 이름 컨벤션을 따르지 않으면 해당 스크립트 스킵하므로!)