Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanOnValidationError does not recover from "Detected failed migration" error #1553

cowwoc opened this issue Mar 13, 2017 · 1 comment


Copy link

cowwoc commented Mar 13, 2017

What version of Flyway are you using?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

MySQL 5.6

What operating system are you using?

Windows 10

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Ran Flyway.migrate() with cleanOnValidationError = true.

What did you expect to see?
  • Flyway detects failed migration.
  • Flyway runs clean before migrate()
What did you see instead?
  • Flyway detects failed migration, throws exception and dies

Looking at the code in MigrationInfoImpl.validate() it's not clear if this behavior is by design or simply a typo. Consider having cleanOnValidationError also recover from this state as well. This method is called validate() after all, and I have instructed Flyway to clean on any validation error :)

I believe returning the error message instead of throwing FlywayException would fix this issue.

Copy link

cowwoc commented Mar 13, 2017

I now believe this is a legitimate bug. This behavior is not present in Flyway 4.0.3. I see a related commit here: e5b972f#diff-3bead47870f573a41667f6b76d7df95e

but my migration is not a repeatable migration.

axelfontaine pushed a commit to flyway/ that referenced this issue Apr 27, 2017
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants