Flyway baselineOnMigrate Skipping Migrations in CI
With baselineOnMigrate=true, Flyway baselines an existing database and then skips every migration at or below baselineVersion. If the baseline version is set too high, your early migrations are silently treated as already applied and never run.
What this error means
flyway migrate succeeds but tables from early migrations are missing, because Flyway baselined at a version that covered them. On a fresh CI database this leaves the schema incomplete.
Creating Schema History table with baseline ...
Successfully baselined schema with version: 1
Schema is up to date. No migration necessary.
(V1.1 / V1.2 never ran - baselineVersion=1 marked them below baseline)Common causes
baselineVersion set at/above real migrations
Flyway ignores migrations with version ≤ baselineVersion. If baselineVersion equals or exceeds your first real migration, those are skipped as "below baseline".
baselineOnMigrate used on a clean CI database
On an empty database you want the full history to run. baselineOnMigrate is for adopting a pre-existing schema, not for fresh CI databases.
How to fix it
Don’t baseline a clean CI database
For an empty CI database, let Flyway run the full history from V1 - no baseline needed.
flyway migrate # no -baselineOnMigrate on a fresh databaseSet baselineVersion below your first migration
When adopting an existing schema, pick a baseline version lower than any migration you still want applied (commonly 0).
flyway migrate -baselineOnMigrate=true -baselineVersion=0How to prevent it
- Use empty databases in CI without
baselineOnMigrate. - Reserve baseline for adopting genuinely pre-existing schemas.
- Set
baselineVersionbelow the first migration you need applied.