Skip to content
Latchkey

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.

flyway output
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.

Terminal
flyway migrate   # no -baselineOnMigrate on a fresh database

Set baselineVersion below your first migration

When adopting an existing schema, pick a baseline version lower than any migration you still want applied (commonly 0).

Terminal
flyway migrate -baselineOnMigrate=true -baselineVersion=0

How to prevent it

  • Use empty databases in CI without baselineOnMigrate.
  • Reserve baseline for adopting genuinely pre-existing schemas.
  • Set baselineVersion below the first migration you need applied.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →