quarkus: Flyway with "multiple datasources" does not migrate at start
Describe the bug There are two datasources that should be be migrated on startup by Flyway, but the scripts are not executed. From the logs it can bee seen that the directories are recognized correctly by the Flyway extension, but not applied later. This has been working before (~1.3.x) and stopped working with current master source.
Example (database/mycompany)
Adding application migrations in path 'quarkus-quickstarts/hibernate-orm-quickstart-multi-tenancy/target/classes/database/mycompany/' using protocol 'file'
Database: jdbc:postgresql://localhost:5433/mycompany
Current version of schema "mycompany": null
Schema "mycompany" is up to date. No migration necessary.
Expected behavior The scripts in “src/main/resources/database” should be used for migration on startup.
Actual behavior The scripts in “src/main/resources/database” are not applied on startup.
To Reproduce Steps to reproduce the behavior:
- Checkout Quickstart fork: https://github.com/michael-schnell/quarkus-quickstarts/
- Change into hibernate-orm-quickstart-multi-tenancy
- Execute “DATABASE Multitenancy” example as described in README.md
- Check the log output: The two datasource schemas “base” and “mycompany” are not applied
Configuration See https://github.com/michael-schnell/quarkus-quickstarts/blob/master/hibernate-orm-quickstart-multi-tenancy/src/main/resources/application.properties
Log
2020-05-18 16:04:33,275 INFO [io.qua.fly.FlywayProcessor] (build-61) Adding application migrations in path 'quarkus-quickstarts/hibernate-orm-quickstart-multi-tenancy/target/classes/db/migration/' using protocol 'file'
2020-05-18 16:04:33,277 INFO [io.qua.fly.FlywayProcessor] (build-61) Adding application migrations in path 'quarkus-quickstarts/hibernate-orm-quickstart-multi-tenancy/target/classes/database/mycompany/' using protocol 'file'
2020-05-18 16:04:33,291 INFO [io.qua.fly.FlywayProcessor] (build-61) Adding application migrations in path 'quarkus-quickstarts/hibernate-orm-quickstart-multi-tenancy/target/classes/database/base/' using protocol 'file'
2020-05-18 16:04:33,291 INFO [io.qua.fly.FlywayProcessor] (build-61) Adding application migrations in path 'quarkus-quickstarts/hibernate-orm-quickstart-multi-tenancy/target/classes/db/migration/' using protocol 'file'
2020-05-18 16:04:36,831 INFO [io.agr.pool] (Quarkus Main Thread) Datasource '<default>': Initial size smaller than min. Connections will be created when necessary
2020-05-18 16:04:36,835 INFO [io.agr.pool] (Quarkus Main Thread) Datasource 'mycompany': Initial size smaller than min. Connections will be created when necessary
2020-05-18 16:04:36,840 INFO [io.agr.pool] (Quarkus Main Thread) Datasource 'base': Initial size smaller than min. Connections will be created when necessary
2020-05-18 16:04:36,938 INFO [org.fly.cor.int.lic.VersionPrinter] (Quarkus Main Thread) Flyway Community Edition 6.4.2 by Redgate
2020-05-18 16:04:37,092 INFO [org.fly.cor.int.dat.DatabaseFactory] (Quarkus Main Thread) Database: jdbc:postgresql://localhost:5433/mycompany (PostgreSQL 12.2)
2020-05-18 16:04:37,123 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Current version of schema "mycompany": null
2020-05-18 16:04:37,124 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Schema "mycompany" is up to date. No migration necessary.
2020-05-18 16:04:37,140 INFO [org.fly.cor.int.dat.DatabaseFactory] (Quarkus Main Thread) Database: jdbc:postgresql://localhost:5432/quarkus_test (PostgreSQL 12.2)
2020-05-18 16:04:37,153 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Current version of schema "public": << Empty Schema >>
2020-05-18 16:04:37,153 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Schema "public" is up to date. No migration necessary.
2020-05-18 16:04:37,685 INFO [io.quarkus] (Quarkus Main Thread) hibernate-orm-quickstart-multi-tenancy 1.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 6.337s. Listening on: http://0.0.0.0:8080
2020-05-18 16:04:37,687 INFO [io.quarkus] (Quarkus Main Thread) Profile database activated. Live Coding activated.
2020-05-18 16:04:37,688 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, flyway, hibernate-orm, jdbc-postgresql, mutiny, narayana-jta, resteasy, resteasy-jsonb]
^C2020-05-18 16:04:42,798 INFO [io.quarkus] (Quarkus Main Thread) hibernate-orm-quickstart-multi-tenancy stopped in 0.029s
Environment (please complete the following information):
- Linux quarkus-vm 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- openjdk version “11.0.6” 2020-01-14
- OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
- OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
- Quarkus: Commit 87522320380e9f201a2f4c027f3e50bc1ffd6f06
- apache-maven-3.6.2
Additional context I’m currently preparing a quickstart for the new Hibernate multi-tenancy feature. This example was already working fine with 999-SNAPSHOT from source ~1.3.x, but it fails now with current Quarkus master source. The problem is actually not related to the new feature as it happens before anything from that code is executed. The problem is just the missing Flyway migration. It seems to be something that changed between ~1.3.x and the current master most likely in the Flyway extension.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
- Fix issue with build time config in dev mode Fixes #9296 Fixes #9415 — committed to stuartwdouglas/quarkus by stuartwdouglas 4 years ago
- Add test for #9415 — committed to stuartwdouglas/quarkus by geoand 4 years ago
I’ll take a look
OK
In any case, if no one beats me to it, I’ll continue debugging tomorrow