2
votes

Currently using flyway to version database scripts. I'm at the point where I want to baseline the database version (version 10), such that when I migrate new scripts, that it doesn't scan/ validate the previous scripts going forward.

I tried the following statement:

 mvn flyway:baseline -Dflyway.url=jdbc:mysql://localhost:3306/db -Dflyway.user=username -Dflyway.baselineVersion=10.0 -Dflyway.baselineDescription=First_Baseline

However when i try and run this statement, i get the following error:

[ERROR] Failed to execute goal org.flywaydb.pro:flyway-maven-plugin:5.0.7:baseline (default-cli) on project myProject: org.flywaydb.core.api.FlywayException: Unable to baseline schema history table "public"."flyway_schema_history" as it already contains migrations -> [Help 1]

Is anyone able to provide any reason why I cannot baseline my existing database going forward (even though Flyway baseline is designed to baseline existing database - looking through the documentation)?

Any advice is appreciated

Thanks.

1

1 Answers

0
votes

even though Flyway baseline is designed to baseline existing database - looking through the documentation

Not certainly in that way.
Flyway baseline is designed to baseline existing database without applied migrations (when you start using Flyway in a project with an existing database).

There is an old associated issue in the Flyway's Github - https://github.com/flyway/flyway/issues/470