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

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

What exactly is your use case for this?

@DanskerDave
Copy link
Author

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

@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 pushed a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Jul 9, 2018
@axelfontaine
Copy link
Contributor

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
Development

No branches or pull requests

2 participants