I want to use flyway for an existing application.
There should be two different cases:
1) Application installation: DDL and initilization of the Database
2) Application update: migrate database
The problem is if i install Version 6.0 i have e.g.:
V1_0_1__CreateShema (for 6.0.0) V1_0_2__InitData (for 6.0.0) .... V4_0_0__Update_DDL_and_DML V5_0_0__Update_DDL_and_DML V6_0_0__Update_DDL_and_DML
If i set init version to V1.0.0 it will execute all updates until V6_0_0 but it should skip all updates after initialization of the Database.
To install an old shema so i can use all udpate scripts even for a fresh install would be very hard (no db version history so i have to do reverse engineering)
I could use a workaround:
1) Check if version table exist 2) If not - migrate to version 1.0.2 3) drop the version table 4) init again with version 6.0.0
There should be a better way isnt it?