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

Statement-level callbacks: before, after and after error #1289

Closed
DanskerDave opened this issue Apr 19, 2016 · 4 comments
Closed

Statement-level callbacks: before, after and after error #1289

DanskerDave opened this issue Apr 19, 2016 · 4 comments

Comments

@DanskerDave
Copy link

@DanskerDave DanskerDave commented Apr 19, 2016

As I've been unable to find a way to process multiple queries with a single Statement in Oracle with JDBC, I assume that for Oracle somewhere in Flyway each *.sql file is parsed into a Collection of Statements before being executed one-by-one (in JdbcTemplate oder?).

If that is the case, it would be nice to have yet another pair of FlywayCallback methods...
before/afterEachMigrateStatement, say
...to handle each Statement.
The signature should be something like:
void beforeEachMigrateStatement(Connection con, MigrationInfo info, ?String? statement);

A Statement-level Error Callback similar to that described in Feature Request #1283 would then be quite useful too...

@axelfontaine axelfontaine added this to the Someday-Maybe milestone Nov 26, 2017
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Feb 26, 2018

What exactly is your use case for this?

@DanskerDave
Copy link
Author

@DanskerDave DanskerDave commented Feb 26, 2018

Unfortunately it's nearly 2 years since I submitted the request & I haven't worked with flyway since.
As far as I recall, the main use I had at the time was Logging.
But I can imagine there may well be other use cases.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Feb 26, 2018

@DanskerDave Thanks. I'm closing this now since there hasn't been anybody else in this time needing this.

@axelfontaine axelfontaine removed this from the Someday-Maybe milestone Mar 26, 2018
@axelfontaine axelfontaine reopened this Jun 19, 2018
@axelfontaine axelfontaine added this to the Flyway 5.2.0 milestone Jun 19, 2018
@axelfontaine axelfontaine changed the title Feature Request: new Callback: afterEachMigrateStatement New Callbacks: beforeEachMigrateStatement, afterEachMigrateStatement & afterEachMigrateStatementError Jun 28, 2018
@axelfontaine axelfontaine changed the title New Callbacks: beforeEachMigrateStatement, afterEachMigrateStatement & afterEachMigrateStatementError Statement-level callbacks: before, after and after error Jul 9, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jul 10, 2018

This has now been implemented with 6 new callbacks:

  • beforeEachMigrateStatement
  • afterEachMigrateStatement
  • afterEachMigrateStatementError
  • beforeEachUndoStatement
  • afterEachUndoStatement
  • afterEachUndoStatementError

They allow for

  • statement validation against rules (no grants for example)
  • regular maintenance after specific statements
  • overriding errorhandling of specific statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.