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

Flyway migrations of defined locations are not applied anymore #10041

Closed
henrikengelbrink opened this issue Jun 16, 2020 · 8 comments · Fixed by #10718
Closed

Flyway migrations of defined locations are not applied anymore #10041

henrikengelbrink opened this issue Jun 16, 2020 · 8 comments · Fixed by #10718
Assignees
Labels
area/flyway kind/bug Something isn't working
Milestone

Comments

@henrikengelbrink
Copy link

Describe the bug
I want to use different database migrations with flyway for testing.
I defined two different locations for the flyway migrations in the application.properties:

%test.quarkus.flyway.locations=classpath:/db/migration/,classpath:/db/testing/

Expected behavior
I expect that all migrations in the folders migration and testing are applied

Actual behavior
Only the migrations in the migration folder are applied, anything in testing is ignored.

To Reproduce
Steps to reproduce the behavior:

  1. Use quarkus-flyway version newer than 1.4.2
  2. Define non-default location for flway migrations (quarkus.flyway.locations)
  3. Start application, only migrations in default path are applied

Configuration

quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username = ${POSTGRES_USER:postgres}
quarkus.datasource.password = ${POSTGRES_PASSWORD:postgres}
quarkus.datasource.url = ${POSTGRES_URL:jdbc:postgresql://localhost:5432/postgres}
quarkus.flyway.migrate-at-start=true
quarkus.swagger-ui.always-include=true

%test.quarkus.http.test-port=0
%test.quarkus.datasource.driver=org.testcontainers.jdbc.ContainerDatabaseDriver
%test.quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQL9Dialect
%test.quarkus.datasource.url=jdbc:tc:postgresql:latest:///postgres
%test.quarkus.flyway.migrate-at-start=true
%test.quarkus.flyway.clean-at-start=true
%test.quarkus.flyway.locations=classpath:/db/migration/,classpath:/db/testing/

Environment (please complete the following information):

  • Output of uname -a or ver:
    Darwin Henriks-MBP-3.fritz.box 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Output of java -version:
    openjdk version "13.0.1" 2019-10-15
    OpenJDK Runtime Environment (build 13.0.1+9)
    OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
  • GraalVM version (if different from Java): -
  • Quarkus version or git rev: 1.5.2
  • Build tool (ie. output of mvnw --version or gradlew --version):
    Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
    Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
    Default locale: en_DE, platform encoding: US-ASCII
    OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"

Additional context
This is working in version 1.4.2.Final of quarkus-flyway but not with the newer ones.

@henrikengelbrink henrikengelbrink added the kind/bug Something isn't working label Jun 16, 2020
@geoand geoand changed the title Flway migrations of defined locations are not applied anymore Flyway migrations of defined locations are not applied anymore Jun 16, 2020
@geoand geoand self-assigned this Jun 16, 2020
@geoand
Copy link
Contributor

geoand commented Jun 16, 2020

Hm... I was not able to reproduce this... Our integration test (

quarkus.flyway.locations=db/location1,classpath:db/location2
) is properly picking up all locations.

Do you perhaps have a project you can share which displayes the behavior you mention?

@gsmet
Copy link
Member

gsmet commented Jun 16, 2020

How do you apply the test profile when starting the application?

quarkus.flyway.locations is a build time property so it cannot be changed at runtime.

@henrikengelbrink
Copy link
Author

@geoand Unfortunately, I can't share this specific project, it is a company owned internal project, I'll try to create a new project for debugging purpose in the next days.

@gsmet I'm running mvn clean test, this should enable the test profile, right ?

@geoand
Copy link
Contributor

geoand commented Jul 14, 2020

@henrikengelbrink were you able to come up with a reproducer for this? We haven't had anyone report any similar issue

@henrikengelbrink
Copy link
Author

Sorry for the late answer!

I've created a simple project with the same settings/dependencies.

If you run mvn clean test on this repo it will fail, because the SQL scripts in db/test_data are not executed though it is configured in the application.properties. If I change quarkus-flyway version explicit back to 1.4.2.Final it is working.

@geoand
Copy link
Contributor

geoand commented Jul 14, 2020

Thanks @henrikengelbrink.

#10718 fixes the issue

@henrikengelbrink
Copy link
Author

Thank you @geoand

geoand added a commit to geoand/quarkus that referenced this issue Jul 14, 2020
geoand added a commit that referenced this issue Jul 14, 2020
Properly determine classpath locations in Flyway
@gsmet gsmet added this to the 1.6.1.Final milestone Jul 16, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 16, 2020
@alessandroAmedei
Copy link

How do you apply the test profile when starting the application?

quarkus.flyway.locations is a build time property so it cannot be changed at runtime.

So if i want to have multiple enviroment i have to package multiple times specifying the quarkus profile for each one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flyway kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants