Flyway error java.lang.IllegalArgumentException

Viewed 1629

Trying to run Flyway, I get the following error

ERROR: java.lang.IllegalArgumentException: No enum constant org.flywaydb.core.api.MigrationType.DELETE

My command is

flyway -user=???? -password=???? -locations="filesystem:." -configFiles=flyway-control-uat.conf migrate

I have tried using "repair" as well as "migrate" but with the same result

My version of flyway is Flyway Community Edition 6.5.5 by Redgate

Thanks

PS: we have been using flyway quite a lot without issue so far

2 Answers

My workstation had Flyway community edition v6.5.

A colleague of mine had updated his version to v7.5 and performed some migrations on our database.

The way I fixed the immediate problem was to uninstall flyway from our database (not uninstall the software itself). Then run a new baseline and this worked.

However, I had taken a backup of the database before doing this. So following the comment from Julia Hayward, I updated my own version to v7.5 and the problem disappeared (from the copy I had made).

So my understanding is that trying to "migrate" my database with v6.5 while someone else had already "migrated" with v7.5, combined with the various changes we did in our scripts ended up with this unhappy situation.

So if it happens to you, make sure you are all on the same version.

As Eric Mament mentioned this happened to me when I tried to repair a database where Flyway 6 was used, using my local Flyway 7.

The way I fixed this is simply by deleting the rows from the flyway schema history table which were not backwards compatible with Flyway 6.

DELETE FROM flyway_schema_history where type = 'DELETE'

Afterwards I ran flyway validate, using local version 6 and it worked

flyway validate 
Related