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

Callbacks for errors #1392

ctmay4 opened this issue Aug 5, 2016 · 1 comment

Callbacks for errors #1392

ctmay4 opened this issue Aug 5, 2016 · 1 comment


Copy link

ctmay4 commented Aug 5, 2016

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)?


What operating system are you using?

CentOS, Windows

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

This is not a bug, but a use-case I don't think is handled. For our migrations, we have a "pre()" script that runs before we do migrations. It's purpose is to revoke connection privileges to other users to the database we are migrating. It works perfectly with a beforeMigrate callback. We also have a "post()" script that restores the connect privileges. We are using afterMigrate for that. When the migrate() call is successful, this works fine. When one of the migration scripts fails, however, we still want to run our post script. However afterMigrate is not triggered if one of the scripts fails.

Is there a way have a callback that is called after a migration whether the migration was successful or not?

@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Nov 27, 2017
@axelfontaine axelfontaine changed the title afterMigrate and failed migrations Callback for afterMigrate and failed migrations Nov 27, 2017
@axelfontaine axelfontaine changed the title Callback for afterMigrate and failed migrations Callbacks for errors Mar 1, 2018
axelfontaine pushed a commit to flyway/ that referenced this issue Mar 1, 2018
Copy link

This has now been implemented. We added error callbacks for all actions, not just migrate.

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