I try use flyway for migration. I find this option
spring.flyway.target= # Target version up to which migrations should be considered.
But I need set version with which to start migration. For exmple I need start migration from V3_foo.sql
Can I do it?
Briefly why I need it. I have a database with data. No migration tools have been used before. Everything was done manually. Now I have created an init.sql
and placed in it the creation of the entire base structure. Now, when adding changes, I will start the migration from version 2. And if you need to run on a new empty database - from version 1
Baseline is the flyway feature you need.
If your case, baseline
your database with flyway.baselineVersion=2
will tell flyway that your database is already at the version 2. Any subsequent flyway migrate
will only process migrations greater than 2.
Note: If previous migrations failed, it may be necessary to drop table flyway_schema_history
first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With