Issue with flyway-core 9.11.0 scripts MARKED AS DELETED
Which version and edition of Flyway are you using?
9.11.0 Enterprise (Previous Version used was 6.4.1 and with this version we don't have this issue) [We're upgrading flyway-core to the newest one]
If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)
This happens only with the newer edition (9.11.0) (Marking as DELETED), already tried solving it with this other comments in this issue (https://github.com/flyway/flyway/issues/3180)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Java API
Which database are you using? (Type & version)
Oracle 19c Enterprise Edition
Which operating system are you using?
Windows 10 21H2
What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)
I have an Eclipse App with many folders to execute scripts in some 'order', this order is like:
FOLDER A
R__00
FOLDER A1
V__1.001
V__1.002
FOLDER A2
R__01_A
R__SYN
FOLDER B
V__3.01
V__3.02
FOLDER C
R__FN
R__PB
R__PH
R__SP
R__VIEW
R__GRANTAnd the Java Process is: First Folder Flyway.configure().locations(classPath).licenseKey(KEY).table("schema_history").dataSource(DS).load();
All the other folders
Flyway.configure().locations(classPath).licenseKey(KEY).failOnMissingLocations(true).baselineOnMigrate(true).validateOnMigrate(false).table("schema_history").dataSource(DS).load();
classPath stands for the path of every FOLDER and they're located on the base folder 'db/migration/' + folder_nameThis is for some business implementations that are used for the client, so those are needed in that order to evade compilation error between objects and other implementations. The first folder (FOLDER A) contains only 1 REPEATABLE MIGRATION, that is MARKED AS DELETED on every execution. The second folder (FOLDER A1) contains a lot of VERSIONABLE MIGRATIONS, that doesn't happen here, they are counted on the "schema_history" and are counted within the DB version. The third folder (FOLDER A2) contains many REPEATABLE MIGRATIONS, same happens here (MARKED AS DELETED) on every execution. The fourth folder (FOLDER B) same as FOLDER A1. The last folder (FOLDER C) also contains many REPEATABLE MIGRATIONS, same happens here.
What did you expect to see?
Only 1 Execution for every SCRIPT, unless is a R__ and I changed something on the script to change the checksum and repeat the execution, not to be repeated everytime I run the app, and doesn't have registers of DELETED on the "schema_history". It seems like the function repair doesn't work properly for my implementation, if I have 20 REPEATABLE sql files, they are marked N times (N executions) on the schema_history, even if it doesn't have changes on the checksum.
What did you see instead?
All the FOLDER A, FOLDER A2 and FOLDER C Marked as DELETED and this makes the flyway execution to fail because I'm doing a DML (INSERT) and it tries to insert a DUPLICATE VALUE (PK). And (i.e.) if the scripts is validated with a DELETE before the INSERT statement to make sure it pass the execution, the process continue executing the R__ files again and again and marking them N times.
Source: flyway/flyway