Flyway upgrade from 3.2.1 to 4.0 fails with Oracle error ORA-00955: name is already used by an existing object #1235
What version of Flyway are you using?
What database are you using (type & version)?
Oracle 11g (18.104.22.168.0)
What operating system are you using?
Windows 7 SP1
What did you do?
After replacing flyway-core-3.2.1.jar with flyway-core-4.0.jar and redeploying my application, Flyway attempts to upgrade the "schema_version" table, but fails with the following Oracle error:
At issue is the fact that the upgrade script removes the old PK constraint using the following statement:
While this does remove the PK constraint, it does not always remove the implicit index created with the same name. As a result, the upgrade script fails when attempting to create a new constraint with the name "schema_version_pk". Replacing the above statement with the one below in the Oracle upgrade script resolves this issue:
What did you expect to see?
I expected to see the flyway "schema_version" table successfully upgraded.
What did you see instead?
The text was updated successfully, but these errors were encountered:
This change contains two modifications: * delete the name of the PK to be dropped, because it is not valid SQL (see https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_3001.htm#i2104014) * implement the only working solution for #1235, which was initially suggested by @kevin-wimmer - using the DROP INDEX clause