313-frameworks-spring-db-migrations-flyway
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpring — Database migrations (Flyway)
Spring — Database migrations (Flyway)
Apply Flyway migration guidelines for Spring Boot.
What is covered in this Skill?
- flyway-core and database-specific Flyway modules (e.g. PostgreSQL) with Spring Boot BOM
- Versioned SQL under (
src/main/resources/db/migration)V{version}__{description}.sql - properties: locations, baseline-on-migrate, validate-on-migrate
spring.flyway.* - Optional Java migrations () for data backfills
BaseJavaMigration - Forward-only discipline: do not rewrite applied migrations in shared environments
- Coordination with and
@311-frameworks-spring-jdbc@312-frameworks-spring-data-jdbc
Scope: Apply recommendations based on the reference rules and good/bad examples.
应用Spring Boot的Flyway迁移指南。
本技能涵盖哪些内容?
- 基于Spring Boot BOM的flyway-core及数据库专属Flyway模块(例如PostgreSQL)
- 下的版本化SQL文件(命名格式为
src/main/resources/db/migration)V{version}__{description}.sql - 属性:locations、baseline-on-migrate、validate-on-migrate
spring.flyway.* - 用于数据回填的可选Java迁移()
BaseJavaMigration - 仅向前迁移准则:在共享环境中不要重写已应用的迁移
- 与和
@311-frameworks-spring-jdbc的协同@312-frameworks-spring-data-jdbc
适用范围: 根据参考规则和正反示例应用建议。
Constraints
约束条件
Before applying Flyway or SQL changes, ensure the project compiles. After improvements, run full verification.
- MANDATORY: Run or
./mvnw compilebefore applying any changemvn compile - SAFETY: If compilation fails, stop immediately
- VERIFY: Run or
./mvnw clean verifyafter applying improvementsmvn clean verify - BEFORE APPLYING: Read the reference for detailed rules and good/bad patterns
在应用Flyway或SQL变更前,确保项目可编译。完成改进后,运行完整验证。
- 强制要求:在进行任何变更前运行或
./mvnw compilemvn compile - 安全提示:如果编译失败,立即停止操作
- 验证步骤:完成改进后运行或
./mvnw clean verifymvn clean verify - 应用前须知:阅读参考文档了解详细规则和正反模式
When to use this skill
何时使用本技能
- Add or review Flyway migrations in a Spring Boot project
- Configure spring.flyway or db/migration layout
- 在Spring Boot项目中添加或审核Flyway迁移
- 配置spring.flyway或db/migration目录结构
Reference
参考资料
For detailed guidance, examples, and constraints, see references/313-frameworks-spring-db-migrations-flyway.md.
如需详细指南、示例和约束条件,请查看references/313-frameworks-spring-db-migrations-flyway.md。