Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
@coderabbitai
이미 개발서버에 반영된 flaway 스크립트 파일 수정해도 문제 없는지 알려줘
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.
@Gyuhyeok99
Flyway 마이그레이션 파일 수정 관련 답변
이미 개발 서버에 반영된 Flyway 스크립트를 수정하는 것은 일반적으로 권장되지 않습니다. 다음 이유들 때문입니다:
1. 체크섬 검증 실패 위험
Flyway는 각 마이그레이션 파일의 체크섬을
flyway_schema_history테이블에 저장합니다. 이미 실행된 파일을 수정하면 체크섬이 달라져서 다음 배포 시 Flyway가 검증 오류를 발생시킵니다:2. 환경 간 불일치 문제
위 환경들과 동기화 문제가 발생할 수 있습니다.
3. 현재 PR의 접근 방식 분석
PR에서 수행하는 작업:
flyway_schema_history에서 V34 레코드 삭제application테이블에서 컬럼 수동 삭제이 방식은 개발 환경에서는 가능하지만 몇 가지 주의사항이 있습니다:
4. 권장 사항
옵션 A: 새로운 마이그레이션 생성 (권장)
옵션 B: 기존 파일 수정 (현재 PR 방식)
만약 V34를 수정해야 한다면:
필수 체크리스트:
실행 순서:
5. 주의사항
결론
개발 서버에만 반영되었고 프로덕션에는 반영되지 않았다면, PR의 접근 방식도 가능합니다. 하지만 새로운 마이그레이션 파일(V35)을 생성하는 것이 더 안전하고 Flyway의 의도된 사용 방식입니다.
어떤 방식을 선택하시겠습니까?
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.
@whqtker 이거 확인 한 번 부탁드립니다
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.
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.
@coderabbitai 애초에 V34 스크립트가 잘못되었기에(gpa 테이블은 존재하지 않음) V35 스크립트를 작성한다 한들, V34 적용 시 문제가 발생하고, V35는 적용되지 않는 거 아니니 ?
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.
@whqtker 정확한 지적입니다! 말씀하신 대로 V34가 실행 중 실패했기 때문에 V35로 해결할 수 없는 상황입니다.
상황 분석
문제점
gpa테이블에 대한 ALTER TABLE 구문을 포함gpa테이블에서 에러 발생flyway_schema_history에 기록됨 (또는 부분적으로만 실행됨)V35 생성이 작동하지 않는 이유
현재 PR의 접근 방식이 올바른 이유
말씀하신 것처럼 V34 자체를 수정하는 것이 유일한 해결책입니다:
수정된 V34의 내용
필요한 작업 (PR에서 수행 중)
flyway_schema_history에서 V34 레코드 삭제application테이블의created_at,updated_at수동 삭제결론
이전 답변에서 V35 생성을 권장했지만, V34가 실패한 상황에서는 V34 자체를 수정하는 것이 올바른 접근입니다. 제 답변이 현재 상황을 충분히 고려하지 못했습니다.
현재 PR의 접근 방식이 정확하며, 다음을 확인하시면 됩니다:
application테이블 컬럼 수동 삭제Uh oh!
There was an error while loading. Please reload this page.
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.
@coderabbitai 답변, PR 등을 고려하지 않고 오로지 현 문제에 초점을 맞췄을 때, 가장 현명한 해결 방법은 무엇인가 ?
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.
@whqtker
가장 현명한 해결 방법
오로지 기술적 관점에서 볼 때, 가장 깔끔한 해결 방법은 다음과 같습니다:
해결 전략: V34 수정 + Flyway Repair
1️⃣ 현재 상태 파악
2️⃣ Flyway 상태 복구
Flyway repair가 하는 일:
3️⃣ 부분 적용된 변경사항 롤백
4️⃣ V34 스크립트 수정
5️⃣ 마이그레이션 재실행
6️⃣ 검증
왜 이 방법이 가장 현명한가?
✅ 장점
대안: 새로운 버전으로 보상 (프로덕션이 포함된 경우)
만약 프로덕션에도 V34가 부분적으로 적용되었다면:
하지만 현재는 개발 서버만 영향받았으므로 V34 수정이 최선입니다.