Skip to content

Conversation

@whqtker
Copy link
Member

@whqtker whqtker commented Jul 19, 2025

관련 이슈

작업 내용

기존에는 flyway의 파일명, 체크섬 등과 같은 유효성 검사가 런타임에 수행되었습니다. 마이그레이션 파일명 오타는 리뷰 시 놓치기 쉽지만 치명적인 결과를 초래하기에 이를 CI 단계에서 발견하도록 build.gradle 을 수정합니다.

flyway 플러그인을 추가해 flywayValidate 태스크를 사용하도록 하였고, 빌드 전 flywayValidate 를 수행하도록 하였습니다.

CI 단계에서 사용할 가상의 DB가 있어야 하기 때문에 임시로 H2 데이터베이스를 생성합니다.

특이 사항

image

파일명 오타를 발견하면 위와 같은 오류 메시지가 출력됩니다.

리뷰 요구사항 (선택)

@whqtker whqtker self-assigned this Jul 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 19, 2025

Walkthrough

  1. Flyway Gradle 플러그인이 버전 9.16.3으로 새롭게 추가되었습니다.
  2. 기존 Flyway core와 MySQL Flyway 의존성에 더해, H2 데이터베이스 런타임 의존성이 새로 포함되었습니다.
  3. build 및 bootJar 작업이 flywayValidate 작업에 의존하도록 설정되어, 빌드나 패키징 전에 반드시 마이그레이션 검증이 실행됩니다.
  4. Flyway 설정 블록이 도입되어, 인메모리 H2 데이터베이스 연결 정보(사용자 "sa", 비밀번호 없음), 마이그레이션 스크립트 위치(파일 시스템 경로 "src/main/resources/db/migration"), 마이그레이션 명명 규칙 검증 활성화, 그리고 "*:pending" 패턴에 해당하는 마이그레이션 무시 옵션이 명확히 지정되었습니다.

Estimated code review effort

1 (~5 minutes)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0f028d and fe6c96e.

📒 Files selected for processing (1)
  • build.gradle (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • build.gradle
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@whqtker whqtker marked this pull request as ready for review July 19, 2025 11:39
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: 2

🧹 Nitpick comments (2)
build.gradle (2)

35-35: 💡 H2 의존성 범위 재검토

  1. runtimeOnly로 두면 운영 Jar에 H2 드라이버가 포함되어 빈번히 보안 스캐너에 걸립니다.
  2. Flyway validate 전용이라면 testRuntimeOnly 또는 developmentOnly로 스코프를 좁히면 더 안전합니다.
-runtimeOnly 'com.h2database:h2'
+testRuntimeOnly 'com.h2database:h2'

75-81: ✅ 빌드 파이프라인 조기 실패 설계, 굿!
build·bootJarflywayValidate에 의존하게 하여 CI 단계에서 즉시 실패하도록 한 점은 환영합니다.
다만, 로컬 개발 시 매번 DB validate가 실행되면 빌드 시간이 길어질 수 있습니다.
1. check 태스크에만 의존시키고, 필요 시 ./gradlew check를 CI에서 호출하는 대안도 고려해 보세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcaba61 and a0f028d.

📒 Files selected for processing (1)
  • build.gradle (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Comment on lines 87 to 95

flyway {
url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
user = 'sa'
password = ''
locations = ['filesystem:src/main/resources/db/migration']
validateMigrationNaming = true
ignoreMigrationPatterns = ['*:pending']
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

❗ Flyway DSL 설정 세부 검토 필요

  1. Gradle 플러그인 JVM이 H2 드라이버를 못 찾을 경우 url만 지정하면 실패합니다. flyway.driver = 'org.h2.Driver'를 명시하거나 buildscript { dependencies }로 드라이버를 추가해 주세요.
  2. ignoreMigrationPatterns는 문자열 CSV를 기대하기 때문에 리스트 사용 시 플러그인 버전에 따라 무시될 수 있습니다.
  3. 마이그레이션 위치를 모듈화한 경우, 멀티모듈 경로도 배열로 추가해 두면 재사용성이 올라갑니다.
flyway {
     url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
     user = 'sa'
     password = ''
-    locations = ['filesystem:src/main/resources/db/migration']
-    validateMigrationNaming = true
-    ignoreMigrationPatterns = ['*:pending']
+    driver = 'org.h2.Driver'
+    locations = [
+        'filesystem:src/main/resources/db/migration'
+    ]
+    validateMigrationNaming = true
+    ignoreMigrationPatterns = '*:pending'
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
flyway {
url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
user = 'sa'
password = ''
locations = ['filesystem:src/main/resources/db/migration']
validateMigrationNaming = true
ignoreMigrationPatterns = ['*:pending']
}
flyway {
url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
user = 'sa'
password = ''
driver = 'org.h2.Driver'
locations = [
'filesystem:src/main/resources/db/migration'
]
validateMigrationNaming = true
ignoreMigrationPatterns = '*:pending'
}
🤖 Prompt for AI Agents
In build.gradle around lines 87 to 95, the Flyway configuration needs
adjustments: explicitly set flyway.driver to 'org.h2.Driver' to ensure the H2
driver is found; change ignoreMigrationPatterns from a list to a comma-separated
string to avoid plugin version issues; and if using a multi-module setup, update
locations to an array including all relevant module migration paths for better
reusability.

Copy link
Collaborator

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

선 approve 합니다~
코멘트 단 부분들 고려해주세요!

build.gradle Outdated
Comment on lines 75 to 82
tasks.named('build') {
dependsOn 'flywayValidate'
}

tasks.named('bootJar') {
dependsOn 'flywayValidate'
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

성혁님 혹시 75-81 라인을 88번의 flyway 블럭 밑으로 내리고
지금의 87번과 88번 사이에 // build 단계에서 flyway 검증 주석을 넣는 것 어떤가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

가독성 측면에서 말씀하신 부분이 더 나은 것 같아 적용했습니다 !

@whqtker whqtker merged commit d71fd0d into solid-connection:develop Jul 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: flyway 마이그레이션 파일명 검증을 빌드 단계에서 수행한다

4 participants