Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between baseline and baselineOnMigrate in flyway?

Tags:

java

flyway

I am using flyway for the first time. I tried to use it in my java swing desktop application. I tried to use it in my project that have existing database. It shows an error

Found non-empty schema(s) schema_name without schema history table! Use baseline() or set baselineOnMigrate to true to initialize the schema history table.

I tried to read some documentation but I can't get simple comparison between the both. Please help me to find the difference and which one I can use in this situation. I am using Java API of flyway.

like image 826
vivekkurien Avatar asked Aug 04 '18 06:08

vivekkurien


1 Answers

baseline() is a method you can call on Flyway. You can invoke it from command line, for example:

flyway baseline

On the other hand, baselineOnMigrate is a setting which you can set int Flyway configuration (if you're using SpringBoot it's application.properties):

flyway.baselineOnMigrate = true

It means "if schema is non-empty and user didn't call flyway baseline explicitly, call it implicitly now"

like image 99
Alexey Soshin Avatar answered Nov 07 '22 05:11

Alexey Soshin