Class SchemaMigrations
Each schema records itself in a history table of its own, so the directory, the HITL queue
and an application's own migrations can share one database. Up to 0.37.0 both schemas used
Flyway's default table, both have a V1, and whichever migrated second failed validation.
The baseline is chosen from the schema's own tables, not from whether the database is empty.
baselineOnMigrate at Flyway's default version 1 skips V1 on any database that
holds some other table, which left agenor_agents missing with no error. So, when the
history table does not exist yet:
- the marker table exists → baseline
1: a database migrated by 0.37.0 or earlier, whose history is in the default table. OnlyV1existed then, so it is atV1at most, and any later version still runs; - otherwise → baseline
0, andV1runs whatever else the database holds.
The migrations live under db/agenor/. Up to 0.37.0 they were under
db/migration/, which Spring Boot's Flyway scans recursively by default, so an
application with Flyway of its own found Agenor's V1s next to its own and failed with
"more than one migration with version 1". A caller still passing an old location is moved to
the new one with a warning, until 1.0.0.
- Since:
- 0.38.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic intmigrate(DataSource dataSource, String location, String historyTable, String markerTable) Applies the pending migrations atlocation, recording them inhistoryTable.
-
Method Details
-
migrate
public static int migrate(DataSource dataSource, String location, String historyTable, String markerTable) Applies the pending migrations atlocation, recording them inhistoryTable.- Parameters:
dataSource- the database to migratelocation- the Flyway location holding this schema's migrationshistoryTable- this schema's own history tablemarkerTable- a tableV1creates, whose presence meansV1has run- Returns:
- the number of migrations executed
-