You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
It seems that this bug has been introduced in commit 0baf57e, which changed the execute method in Flyway.java:
/*private -> testing*/ <T> T execute(Command<T> command) {
...
if (!skipDefaultCallbacks) {
Set<FlywayCallback> flywayCallbacks = new LinkedHashSet<FlywayCallback>(Arrays.asList(callbacks));
flywayCallbacks.add(
new SqlScriptFlywayCallback(dbSupport, scanner, locations, createPlaceholderReplacer(), this));
callbacks = flywayCallbacks.toArray(new FlywayCallback[flywayCallbacks.size()]);
}
...
Whenever the execute method is invoked (and skipDefaultCallbacks is not set), an additional SqlScriptFlywayCallback instance is added to the callbacks property.
The text was updated successfully, but these errors were encountered:
This appears to affect default SQL callbacks on the command line as well (certainly the beforeMigrate and afterMigrate ones). I'm using V4.2.0 and have placed beforeMigrate.sql and afterMigrate.sql in the flyway location and am seeing duplicate 'Executing SQL callback;' messages.
It appears that what I was seeing is that the beforeMigrate.sql and afterMigrate.sql scripts are run for the clean and the migrate command when running 'flyway clean migrate'. But, the additional executions are not before or after the clean phase, they are around the migrate phase.
I realised this when I ran a migrate on a fully up-to-date schema (I wanted to check whether the callbacks are executed when there are no migrations that are required to be run). In this situation there is a single execution of the relevant script rather than two. Adding an (unnecessary) repair to the command line (flyway repair clean migrate) results in three executions of each of the beforeMigrate and afterMigrate callback scripts.
What version of Flyway are you using?
4.2.0
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)?
Oracle 12c (12.1.0.2.0 / 64 Bit)
What operating system are you using?
Windows 7 (64 Bit) / JDK 1.8.0_131
What did you do?
What did you expect to see?
The beforeBaseline.sql script should be executed only once.
What did you see instead?
The beforeBaseline.sql script has been executed twice:
Additional information
It seems that this bug has been introduced in commit 0baf57e, which changed the execute method in Flyway.java:
Whenever the execute method is invoked (and skipDefaultCallbacks is not set), an additional SqlScriptFlywayCallback instance is added to the callbacks property.
The text was updated successfully, but these errors were encountered: