I'm using Flyway to update the DB schema. Currently, the latest version of the schema is 3 (the latest migration file is named V3__postgres.sql).
If I run the application on a database which has an older schema version, Flyway executes the update scripts as expected. However, if I run the app on a new (empty) database, flyway tries to execute the update scripts, but it doesn't find any tables (because Hibernate didn't create them yet), and the app terminates on error.
I would like Flyway to not execute the update scripts on an empty database, since when Hibernate creates the tables, they will be at the latest version anyway.
If I understand it correctly, I should be able to use parameter flyway.baseline-version for this. My theory is that if Flyway doesn't find table schema_version, it should create it and insert a record saying that the DB is at version 3. But even if I set flyway.baseline-version=3, Flyway executes the scripts anyway. I also tried to set parameter flyway.baseline-on-migrate=true and their different combinations but I couldn't get it to work.
Do I understand the baseline-version parameter correctly or am I missing something?
Note: I'm aware that since Spring Boot 2 the parameter namespace has changed to spring.flyway.*, but I'm using Spring Boot 1 so that is not the problem.