Closed gaksenov-cen57237 closed 4 months ago
As workaround, Flyway's integration can be disabled by creating a no-op bean of type FlywayDatabaseExtension
with name "flywayDatabaseExtension"
class NoOpFlywayDatabaseExtension() : FlywayDatabaseExtension() {
public override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any {
return bean
}
public override fun postProcessAfterInitialization(bean: Any, beanName: String): Any {
return bean
}
fun processPendingOperations() {
// do nothing
}
}
Then the Flyway migrations are applied ok, which raises a question - what is the purpose of Flyway's integration in embedded-database-spring-test
?
Thanks for the report. I'll try to investigate it more, but If it works with the flyway database extension disabled, then it's definitely a bug in the library.
The primary purpose of the flyway extension lies in performance optimizations. It offers a more effective background bootstrapping mode, reusing template databases among multiple Spring contexts, and, probably the most important optimization, is the handling of the @FlywayTest
annotation. Without FlywayDatabaseExtension
and OptimizedFlywayTestExecutionListener
, this annotation would trigger a complete cleanup of the database before applying new migrations. The flyway extension can take advantage of template databases to speed it up.
Ok, just to clarify, how do you register Java migrations with Flyway? Do you do it manually using ClassicConfiguration
or FluentConfiguration
, and not using the locations
property, am I right?
Thank You @tomix26, looks fixed
When used with Flyway 9.9+,
Actual: Beans of type
org.flywaydb.core.api.migration.JavaMigration
are not applied during migration phase.Expected: Flyway is properly configured, so that beans of type
org.flywaydb.core.api.migration.JavaMigration
are applied during migration phase.Investigation:
io.zonky.test.db.flyway.FlywayWrapper#getConfig
picks up amodernConfig
in Flyway's config, which doesn't contain an array of JavaMigration objects, therefore missing them. These objects are still present inconfig
property and accessible, though. I don't think JavaMigration was ever deprecated, so the missingjavaMigrations
property inmodernConfig
seems like an issue of Flyway itself. However, this particular bug may be fixed using existing Flyway's API.