fix(flyway): baseline existing schemas at V4 on first run
Local dev databases that existed before Flyway was introduced have tables but no flyway_schema_history. Flyway refuses to migrate a non-empty schema without a history table. baselineOnMigrate=true with baselineVersion=4 stamps those databases as already at V4 without re-running migrations. Fresh databases (CI) have an empty schema so the baseline is never triggered and all 4 migrations run normally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,8 @@ public class FlywayConfig {
|
||||
Flyway flyway = Flyway.configure()
|
||||
.dataSource(dataSource)
|
||||
.locations("classpath:db/migration")
|
||||
.baselineOnMigrate(true)
|
||||
.baselineVersion("4")
|
||||
.load();
|
||||
var result = flyway.migrate();
|
||||
log.info("Flyway: {} migration(s) applied.", result.migrationsExecuted);
|
||||
|
||||
Reference in New Issue
Block a user