Flyway Production Cheat Sheet
Executive Summary
Section titled “Executive Summary”Flyway is a minimalist, opinionated database migration tool that versions schema and reference-data changes through ordered migration scripts, tracked in a schema history table and applied consistently across all environments. It provides a small but powerful command set (migrate, clean, info, validate, repair, baseline, undo in paid editions) and integrates cleanly with Java stacks, especially Spring Boot, as well as with CLI, Maven, Gradle, and Docker workflows.
This cheat sheet focuses on production-grade usage patterns: team-friendly versioning strategies, Spring Boot integration, advanced features (callbacks, placeholders, Java migrations), CI/CD wiring, and operational concerns such as zero-downtime, rollbacks, and debugging.
1. Overview (Quick Recap)
Section titled “1. Overview (Quick Recap)”1.1 What Flyway Does
Section titled “1.1 What Flyway Does”- Treats your database schema like code: changes are stored as ordered migration scripts in VCS and applied incrementally to each environment.
- Manages a schema history table (default
flyway_schema_history) in each database to record applied migrations, checksums, execution order, and success state. - On each run, scans migration locations, compares against history, and executes only pending migrations in order, guaranteeing deterministic evolution.
1.2 Core Concepts
Section titled “1.2 Core Concepts”- Migrations
- Scripts that describe an atomic database change, usually one semantic step such as “add column” or “create index”.
- Written as SQL or Java; SQL is preferred for most DDL/DML, Java for complex data fixes or logic.
- Schema history table
- Created automatically on first migration; default name
flyway_schema_history(older versions usedschema_version). - Stores: version, description, type, script name, checksum, installed-on timestamp, execution time, and success flag.
- Created automatically on first migration; default name
- Versioning
- Versioned migrations use a numeric or dotted version (for example,
1,1.1,2025.03.31.01) that defines ordering. - Repeatable migrations have no explicit version and are re-run when their checksum changes.
- Versioned migrations use a numeric or dotted version (for example,
2. Installation & Setup
Section titled “2. Installation & Setup”2.1 Core Distribution Options
Section titled “2.1 Core Distribution Options”- CLI: stand-alone executable for all major OSes; good for local use, ad-hoc migrations, and CI/CD steps.
- Maven plugin: integrates migrations into Java build lifecycle (for example,
mvn flyway:migrate), useful in legacy or non-Spring projects. - Gradle plugin: similar integration for Gradle builds.
- Docker: Flyway provides official Docker images, allowing migrations to run as containers alongside the application or in pipelines.
- Embedded in Java: Use
org.flywaydb.core.Flywaydirectly for programmatic control.
2.2 CLI Quick Setup
Section titled “2.2 CLI Quick Setup”Typical directory layout:
flyway/ flyway conf/ flyway.conf sql/ V1__init_schema.sql V2__add_user_table.sqlMinimal conf/flyway.conf for PostgreSQL:
flyway.url=jdbc:postgresql://localhost:5432/appdbflyway.user=appflyway.password=secretflyway.locations=filesystem:sqlRun migrations:
./flyway migrate2.3 Maven Integration
Section titled “2.3 Maven Integration”Add plugin to pom.xml:
<build> <plugins> <plugin> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>${flyway.version}</version> <configuration> <url>jdbc:postgresql://localhost:5432/appdb</url> <user>app</user> <password>${db.password}</password> <locations> <location>classpath:db/migration</location> </locations> </configuration> </plugin> </plugins></build>Run:
mvn flyway:migratemvn flyway:info2.4 Gradle Integration
Section titled “2.4 Gradle Integration”Basic Gradle configuration:
plugins { id 'org.flywaydb.flyway' version '10.20.0'}
dependencies { implementation 'org.postgresql:postgresql:42.7.1'}
flyway { url = 'jdbc:postgresql://localhost:5432/appdb' user = 'app' password = System.getenv('DB_PASSWORD') locations = ['classpath:db/migration']}Run:
gradle flywayMigrategradle flywayInfo2.5 Docker Usage
Section titled “2.5 Docker Usage”Basic example with PostgreSQL:
docker run --rm \ -v $(pwd)/sql:/flyway/sql \ flyway/flyway:latest \ -url=jdbc:postgresql://host.docker.internal:5432/appdb \ -user=app \ -password=secret \ migrateUse bind mounts or images that include migrations baked into the container image for deterministic pipelines.
2.6 Spring Boot Integration (high level)
Section titled “2.6 Spring Boot Integration (high level)”- Use
org.flywaydb:flyway-coreand database driver dependency; Boot auto-configures Flyway if it finds both on the classpath and aDataSource. - Default migration location is
classpath:db/migrationwith standard naming conventions. - Configuration is typically done via
application.ymlorapplication.propertiesusingspring.flyway.*keys.
2.7 Folder Structure Best Practices
Section titled “2.7 Folder Structure Best Practices”- For multi-module or microservice setups, keep migrations per service inside that service’s artifact:
service-a/ src/main/resources/db/migrationservice-b/ src/main/resources/db/migration- For monoliths, use logical subfolders or schemas per bounded context if needed, but still maintain a single logical migration sequence per database.
- Keep callbacks and repeatable scripts in the same tree, optionally under separate folders (for example,
db/callbacks) if you prefer separation.
3. Migration Types
Section titled “3. Migration Types”3.1 Versioned vs Repeatable Migrations
Section titled “3.1 Versioned vs Repeatable Migrations”- Versioned
- Prefix
V, followed by version and__description, for exampleV1__init.sql,V2025_03_31_01__add_orders.sql. - Executed exactly once per database; never edited after application in production.
- Prefix
- Repeatable
- Prefix
R__only, no explicit version, for exampleR__views.sql,R__refresh_materialized_views.sql. - Re-executed whenever checksum changes, after all pending versioned migrations.
- Good for views, functions, procedures, reference data snapshots built idempotently.
- Prefix
3.2 Naming Conventions
Section titled “3.2 Naming Conventions”Recommended patterns:
- Versioned (SQL):
V1__init_schema.sqlV1_1__seed_reference_data.sqlV2_0_0__add_customer_table.sqlV2025_03_31_01__add_invoice_indexes.sql- Repeatable (SQL):
R__rebuild_reporting_views.sqlR__refresh_dimension_tables.sql- Java migrations:
V3__migrate_legacy_customer_data.javaR__recalc_statistics.java3.3 Order of Execution
Section titled “3.3 Order of Execution”- Versioned migrations run first, ordered by version number, then filename if versions are equal.
- After all pending versioned migrations complete, repeatable migrations run ordered lexicographically.
- For schemas under baseline, migrations with versions greater than baseline version are eligible to run; lower versions are ignored.
4. Core Commands (CLI + Maven/Gradle)
Section titled “4. Core Commands (CLI + Maven/Gradle)”Flyway exposes seven main commands.
4.1 migrate
Section titled “4.1 migrate”- Applies pending migrations in order.
- CLI:
flyway migrateflyway -locations=filesystem:sql -url=jdbc:postgresql://... migrate- Maven:
mvn flyway:migrate- Gradle:
gradle flywayMigrate4.2 clean (never in production)
Section titled “4.2 clean (never in production)”- Drops all objects in configured schemas, effectively wiping the database.
- Useful for dev/test reset; disable in production via
flyway.cleanDisabled=trueor environment-specific config. - CLI:
flyway clean4.3 info
Section titled “4.3 info”- Shows current schema version, pending migrations, and history.
- CLI:
flyway info - Maven:
mvn flyway:info - Gradle:
gradle flywayInfo
4.4 validate
Section titled “4.4 validate”- Verifies that applied migrations match files on disk by checksum and ordering.
- Catches accidental edits to applied scripts and missing scripts before running new migrations.
- CLI:
flyway validate
4.5 repair
Section titled “4.5 repair”- Repairs the schema history table (for example, updates invalid checksums, removes failed entries) without changing the database schema itself.
- Typically used after fixing an out-of-band modification or when a script was manually adjusted and the change is known to be safe.
- CLI:
flyway repair
4.6 baseline
Section titled “4.6 baseline”- Brings an existing database under Flyway control without replaying all historical changes.
- Sets a baseline version; migrations below this version are ignored, and newer ones are applied on subsequent
migratecalls.
flyway baseline -baselineVersion=100 -baselineDescription="Initial baseline"4.7 undo (Enterprise only)
Section titled “4.7 undo (Enterprise only)”- Executes undo migrations (prefix
U) that reverse specific versioned migrations; only in paid editions. - Community users must implement rollback via forward-only fixes.
flyway undo5. Configuration Deep Dive
Section titled “5. Configuration Deep Dive”5.1 flyway.conf (CLI)
Section titled “5.1 flyway.conf (CLI)”Common options:
flyway.url=jdbc:postgresql://db:5432/appdbflyway.user=appflyway.password=${FLYWAY_DB_PASSWORD}flyway.schemas=publicflyway.locations=filesystem:sqlflyway.table=flyway_schema_historyflyway.baselineOnMigrate=trueflyway.cleanDisabled=trueflyway.placeholders.env=prod- Use environment variables (for example,
${FLYWAY_DB_PASSWORD}) or OS-level secrets instead of plain-text credentials in VCS. - For Oracle, configure service and driver properly:
flyway.url=jdbc:oracle:thin:@//orcl-host:1521/ORCLPDB1flyway.user=APP_SCHEMAflyway.password=${DB_PASSWORD}flyway.schemas=APP_SCHEMA- For MySQL:
flyway.url=jdbc:mysql://db:3306/appdb?useSSL=falseflyway.user=appflyway.password=${DB_PASSWORD}flyway.schemas=appdb5.2 Spring Boot application.yml / application.properties
Section titled “5.2 Spring Boot application.yml / application.properties”Example for PostgreSQL with Hibernate disabled:
spring.datasource.url=jdbc:postgresql://localhost:5432/appdbspring.datasource.username=appspring.datasource.password=${DB_PASSWORD}spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=nonespring.jpa.show-sql=true
spring.flyway.enabled=truespring.flyway.locations=classpath:db/migrationspring.flyway.schemas=publicspring.flyway.table=flyway_schema_historyspring.flyway.baseline-on-migrate=truespring.flyway.clean-disabled=trueEquivalent YAML:
spring: datasource: url: jdbc:postgresql://localhost:5432/appdb username: app password: ${DB_PASSWORD} driver-class-name: org.postgresql.Driver jpa: hibernate: ddl-auto: none flyway: enabled: true locations: classpath:db/migration schemas: public table: flyway_schema_history baseline-on-migrate: true clean-disabled: true5.3 Environment-Specific Configs
Section titled “5.3 Environment-Specific Configs”- Use per-profile properties (
application-dev.yml,application-prod.yml) or externalized configuration. - Example pattern:
- Dev:
clean-disabled=false,baseline-on-migrate=false, additional locations with sample data. - Prod:
clean-disabled=true, strong validation, read-only connections for reporting databases.
- Dev:
- For CLI in CI, pass configuration via environment variables or command-line flags to avoid committing secrets.
5.4 Secrets Handling
Section titled “5.4 Secrets Handling”- Never commit passwords inside
flyway.conforapplication.ymlchecked into version control. - Use:
- Vault or secret managers to inject env vars at runtime.
- CI/CD variables for
flyway.passwordand DB URLs. - Encrypted config stores when required by policy.
6. Schema Versioning Strategy
Section titled “6. Schema Versioning Strategy”6.1 Versioning in Large Teams
Section titled “6.1 Versioning in Large Teams”- Use monotonic increasing versions combined with descriptive names; avoid renumbering or reusing versions once pushed.
- Recommended schemes:
- Simple incremental integers per repo:
V101,V102. - Timestamp-based:
V2026_03_31_1300__description.sqlto minimize collisions across teams.
- Simple incremental integers per repo:
- One DB change per ticket or pull request; script name should reference ticket ID.
6.2 Handling Merge Conflicts
Section titled “6.2 Handling Merge Conflicts”- Avoid editing existing version numbers; instead, resolve conflicts by renaming local files to a new, higher version.
- Typical workflow:
- Branch A adds
V101__add_users.sqland merges first. - Branch B also created
V101__add_roles.sql; on rebase, rename toV102__add_roles.sql. - Resolve any dependency or foreign key ordering issues by adjusting versions.
- Branch A adds
- Do not change already-applied migration content in a shared environment; instead, create a new migration to fix whatever was wrong.
6.3 Branching Strategies
Section titled “6.3 Branching Strategies”- Git Flow
- Feature branches create migrations, merged into
developthenmain. - Ensure integration environments (for example,
dev,staging) are migrated in the same order as merges.
- Feature branches create migrations, merged into
- Trunk-based development
- Prefer timestamp or large-gap integer versions (for example, jump by 10) to make insertions easier.
- Short-lived branches reduce version collision risk.
- For hotfixes against production, create migrations with versions higher than any unreleased dev migrations and ensure consistent backporting to main.
7. Advanced Features
Section titled “7. Advanced Features”7.1 Callbacks
Section titled “7.1 Callbacks”- Callbacks are scripts or Java code executed at specific lifecycle events such as
beforeMigrate,afterMigrate,beforeEachMigrate,afterClean, etc. - Implemented as SQL files with naming like
beforeMigrate__init.sqlin the same locations, or as Java classes implementingCallback. - Example: Java callback configuration:
Flyway flyway = Flyway.configure() .dataSource(dataSource) .locations("db/migration", "db/callbacks") .callbacks(new ExampleFlywayCallback()) .load();flyway.migrate();- Use cases: logging, auditing, toggling features, populating temp tables, or orchestrating optional tasks using placeholders.
7.2 Placeholders
Section titled “7.2 Placeholders”- Key–value replacements used inside SQL scripts using
${name}syntax. - Configure in
flyway.confor Boot config:
flyway.placeholders.env=devflyway.placeholders.batch_size=1000- Example SQL using placeholders:
INSERT INTO audit_config(env, batch_size)VALUES ('${env}', ${batch_size});- Placeholders can also act as on/off switches in callbacks to conditionally execute blocks.
7.3 Java-Based Migrations
Section titled “7.3 Java-Based Migrations”- Extends
BaseJavaMigrationor implementsJavaMigrationto run arbitrary Java code in migrations.
public class V5__Migrate_Legacy_Data extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { try (Statement stmt = context.getConnection().createStatement()) { stmt.executeUpdate("UPDATE customers SET status = 'ACTIVE' WHERE status IS NULL"); } }}- Packaged on the classpath under
db/migrationor configured locations; versioning rules are the same as SQL migrations. - Prefer SQL when possible; reserve Java migrations for complex transformations, large data corrections with streaming, or logic not easily expressed in SQL.
7.4 Multi-Schema Support
Section titled “7.4 Multi-Schema Support”- Configure
flyway.schemasto list schemas under Flyway control. - Example for PostgreSQL:
flyway.schemas=public,reporting- Example for Oracle with separate app and audit schemas:
flyway.schemas=APP_SCHEMA,AUDIT_SCHEMA- Flyway will manage
flyway_schema_historyin the default schema and apply migrations across configured schemas where relevant.
8. Spring Boot Integration (Important)
Section titled “8. Spring Boot Integration (Important)”8.1 Auto-Configuration
Section titled “8.1 Auto-Configuration”- With
flyway-coreon the classpath and aDataSourcebean, Boot auto-configures aFlywaybean and runsmigrateon startup by default. - Boot respects
spring.flyway.*properties to adjust paths, schemas, and behavior.
8.2 Customizing the Flyway Bean
Section titled “8.2 Customizing the Flyway Bean”- Example customization:
@Configurationpublic class FlywayConfig {
@Bean(initMethod = "migrate") public Flyway flyway(DataSource dataSource) { return Flyway.configure() .dataSource(dataSource) .schemas("public", "audit") .locations("classpath:db/migration", "classpath:db/callbacks") .baselineOnMigrate(true) .load(); }}- Set
spring.flyway.enabled=falseif taking full control via custom bean and manual invocation.
8.3 Per-Environment Enable/Disable
Section titled “8.3 Per-Environment Enable/Disable”- Example disabling Flyway in tests while enabling in other profiles:
spring: flyway: enabled: true---spring: config: activate: on-profile: test flyway: enabled: false- Alternatively, use a profile-specific configuration class that only defines the
Flywaybean in certain profiles.
9. Production Best Practices
Section titled “9. Production Best Practices”9.1 Zero-Downtime Deployments
Section titled “9.1 Zero-Downtime Deployments”- Design migrations to be backward compatible with previous application versions:
- Add nullable columns first, deploy app that writes both old and new, backfill data, then make columns non-nullable in a later release.
- For MySQL and PostgreSQL, avoid lock-heavy operations during peak hours; use
CONCURRENTLYfor index creation where supported.
- Never drop or rename columns in the same release where the application still depends on them.
9.2 Backward-Compatible Migrations
Section titled “9.2 Backward-Compatible Migrations”- Use multi-step evolution:
- Release 1: add new column with default or nullable; keep old column.
- Release 2: backfill; update app to read from new column.
- Release 3: remove or deprecate old column.
- For Oracle, consider edition-based redefinition for truly zero-downtime structural changes when available.
9.3 Blue-Green and Rolling Deployments
Section titled “9.3 Blue-Green and Rolling Deployments”- In blue-green setups, both environments must be able to run with the same DB schema version, requiring backward-compatible migrations.
- For rolling deployments, ensure older and newer app instances can share the same database without schema assumptions breaking.
- In highly regulated environments, treat DB migrations as separate deployables with explicit approvals.
9.4 Rollback Strategies and Limitations
Section titled “9.4 Rollback Strategies and Limitations”- Flyway Community is forward-only; there is no automatic rollback.
- Strategies:
- Roll-forward fixes: push a new migration that reverts the change logically (for example, re-add dropped column, restore data from backup tables).
- Use database backups or point-in-time recovery for catastrophic failures.
- In paid editions with undo, maintain
Uscripts that safely reverse changes but still treat them with the same rigor as forward migrations.
10. Common Pitfalls & Debugging
Section titled “10. Common Pitfalls & Debugging”10.1 Failed Migrations
Section titled “10.1 Failed Migrations”- If a migration fails, the schema history entry is marked as failed and future
migratecalls will stop until resolved. - Typical resolution:
- Fix the SQL or Java migration logic.
- Manually correct the database if it is in an inconsistent state.
- Run
flyway repairto remove or adjust the failed entry when safe.
10.2 Checksum Mismatches
Section titled “10.2 Checksum Mismatches”- Occur when a migration file is modified after being applied and validated.
- Never edit production migrations; instead:
- Revert the file to its original content, or
- Create a new migration with the fix.
repaircan update checksums, but only use this after confirming the database already matches the new script content.
10.3 Dirty Schema Handling
Section titled “10.3 Dirty Schema Handling”- A schema is considered dirty when a migration failed part-way and left the history in a failed state.
- Cleanest recovery:
- Manually fix data or structure.
- Use
repairto mark the migration as successful or remove the unneeded entry. - Re-run
migrate.
10.4 Repair Usage
Section titled “10.4 Repair Usage”repairis powerful and dangerous; it does not change schema objects, only the history table, so misuse can make Flyway believe schema is in a different state than reality.- Use only when the actual database has been independently validated and reconciled.
11. Flyway vs Liquibase (Senior Comparison)
Section titled “11. Flyway vs Liquibase (Senior Comparison)”11.1 Conceptual Differences
Section titled “11.1 Conceptual Differences”| Aspect | Flyway | Liquibase |
|---|---|---|
| Change representation | Ordered SQL or Java migrations | Changelogs (SQL, XML, YAML, JSON) with changeSets |
| Ordering | Version numbers and repeatables | Implicit ordering by file and changeSet, can be rearranged |
| Philosophy | Imperative, migration-scripts-first | More declarative, rich changeSet model |
Flyway favors simplicity and explicit, linear migrations, whereas Liquibase emphasizes declarative changelogs and conditional execution.
11.2 When to Use Which
Section titled “11.2 When to Use Which”- Prefer Flyway when:
- Team is Java-centric and comfortable writing plain SQL.
- Migration needs are mostly linear without complex branching or dynamic selection.
- Integration with Spring Boot and JVM CI/CD is primary.
- Prefer Liquibase when:
- Requirements include complex conditional logic, preconditions, and rollbacks managed within the tool.
- There is a need to describe changes in non-SQL formats (XML/YAML/JSON) for cross-database reuse.
- A richer command set and declarative change modeling is desired despite additional complexity.
12. Performance & Scaling
Section titled “12. Performance & Scaling”12.1 Large Databases
Section titled “12.1 Large Databases”- Migrations that touch large tables must be carefully designed to avoid prolonged locks:
- Use batched updates with predicates.
- Use index creation options like
CONCURRENTLYin PostgreSQL where supported. - Schedule heavy migrations during maintenance windows.
- For Oracle and MySQL, consider partitioning and incremental archives for data-movement-heavy migrations.
12.2 Parallel Teams
Section titled “12.2 Parallel Teams”- Clear ownership per schema or service reduces collisions.
- Enforce patterns:
- Each team owns its set of migration locations and schemas.
- Schema review gates for cross-team changes.
- Use timestamp-based versioning to minimize frequent renumbering.
12.3 CI/CD Integration Basics
Section titled “12.3 CI/CD Integration Basics”- Always run
validatein CI beforemigrateto catch ordering and checksum issues early. - Pipeline pattern:
- Build application artifacts.
- Run DB migrations against integration database (
flyway migrate). - Run tests.
- Promote artifacts and migrations together.
- For canary or blue-green deployments, run
migratebefore routing traffic to the new application version.
13. CI/CD Integration
Section titled “13. CI/CD Integration”13.1 GitHub Actions Example
Section titled “13.1 GitHub Actions Example”Basic job running migrations against PostgreSQL:
name: Flyway Migrations
on: push: branches: [ main ]
jobs: migrate-db: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Set up JDK uses: actions/setup-java@v4 with: distribution: temurin java-version: 21
- name: Run Flyway migrations uses: docker://flyway/flyway:latest env: FLYWAY_URL: jdbc:postgresql://db-host:5432/appdb FLYWAY_USER: app FLYWAY_PASSWORD: ${{ secrets.DB_PASSWORD }} with: args: -locations=filesystem:sql migrate13.2 GitLab CI Example
Section titled “13.2 GitLab CI Example”migrate_db: image: flyway/flyway:latest stage: deploy script: - flyway -url=$DB_URL -user=$DB_USER -password=$DB_PASSWORD -locations=filesystem:sql migrate only: - main13.3 Deployment Pipeline Integration
Section titled “13.3 Deployment Pipeline Integration”- Treat DB migrations as a first-class deployable:
- Option 1: Run Flyway as a job before application deployment.
- Option 2: Let the application (Spring Boot) run migrations on startup but gate deployment with DB health checks.
- For highly critical systems, use:
- Pre-prod dry run migrations.
- Snapshot or PITR backup before running prod migrations.
14. Real-World Examples
Section titled “14. Real-World Examples”14.1 Microservices Architecture Lifecycle
Section titled “14.1 Microservices Architecture Lifecycle”- Each microservice has its own database or schema and a dedicated
db/migrationfolder. - Lifecycle per release:
- Developer adds migration
V2026_03_31_01__add_orders_table.sqlin service A. - CI runs
flyway validateandflyway migrateagainst a shared integration database. - Contract tests ensure schema and API alignment.
- On deployment, a DB migration job runs first for service A’s schema; if successful, application pods for service A roll out.
- Developer adds migration
14.2 Multi-Environment Deployment
Section titled “14.2 Multi-Environment Deployment”- Recommended environment order:
dev→qa→staging→prod. - Each environment uses the same migration artifacts from VCS, never edited per environment.
- Environment-specific behavior is controlled via configuration, feature flags, and placeholders, not divergence in migrations.
15. Cheat Sheet (Quick Reference)
Section titled “15. Cheat Sheet (Quick Reference)”15.1 Core Commands
Section titled “15.1 Core Commands”| Command | Purpose | Typical Usage |
|---|---|---|
migrate | Apply pending migrations | flyway migrate |
clean | Drop all objects in schemas (dev/test only) | flyway clean |
info | Show current and pending migrations | flyway info |
validate | Check migrations vs history, verify checksums | flyway validate |
repair | Fix schema history table metadata | flyway repair |
baseline | Start managing existing schema from a version | flyway baseline -baselineVersion=100 |
undo | Run undo migrations (Enterprise) | flyway undo |
15.2 Naming Conventions
Section titled “15.2 Naming Conventions”- Versioned SQL:
V1__init.sqlV2_1__add_customer_table.sqlV2026_03_31_01__add_index_on_order_date.sql- Repeatable SQL:
R__views.sqlR__materialized_views.sql- Java migrations:
V3__backfill_customer_status.javaR__recalc_statistics.java15.3 Common Spring Boot Properties
Section titled “15.3 Common Spring Boot Properties”spring.flyway.enabled=truespring.flyway.locations=classpath:db/migrationspring.flyway.schemas=publicspring.flyway.table=flyway_schema_historyspring.flyway.baseline-on-migrate=truespring.flyway.clean-disabled=truespring.flyway.placeholders.env=dev15.4 Troubleshooting Quick Fixes
Section titled “15.4 Troubleshooting Quick Fixes”- Migration fails: fix SQL, correct DB manually if needed, then run
flyway repairandmigrate. - Checksum mismatch: restore original script or create new migration; use
repaironly after confirming DB matches script. - Dirty schema: inspect schema history, resolve partial changes, then
repairto clear dirty flag. - Accidental
cleanin prod: recover from backups; prevent recurrence withcleanDisabled=truein production configs.
This cheat sheet is optimized for experienced Java engineers who need a compact but practical reference for Flyway in production-grade environments.