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 Plugin does not include version subfolder in script path #11288

Closed
mqs24d opened this issue Aug 8, 2020 · 1 comment · Fixed by #11300
Closed

Flyway Plugin does not include version subfolder in script path #11288

mqs24d opened this issue Aug 8, 2020 · 1 comment · Fixed by #11300
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@mqs24d
Copy link

mqs24d commented Aug 8, 2020

Describe the bug
Since quarkus-version 1.4.2 the flyway plugin does not include the name of the version subfolder into the path of the migration scripts so that quarkus startup fails with an Exception org.flywaydb.core.api.FlywayException: Unable to obtain inputstream for resource: <configured location>/<script filename>.

Expected behavior
Having a folder structure like this:

sql/
+- v1_0/
|   +- V1_0_0_001__DoSomethingForVersion1.sql
+- v2_0/
│   +- V2_0_0_001__DoSomethingForVersion2.sql

If sql is the configured location i would expect that the flyway plugin builds up the path including the version subfolder:

  • sql/v1_0/V1_0_0_001__DoSomethingForVersion1.sql
  • sql/v2_0/V2_0_0_001__DoSomethingForVersion2sql

Actual behavior
In the quarkus version 1.5, 1.6 and even 1.7.0.RC2 the path for the migration paths is build up like this:

  • sql/V1_0_0_001__DoSomethingForVersion1.sql
  • sql/V2_0_0_001__DoSomethingForVersion2sql
    To workaround the problem the subfolders must be configured as separate locations

So quarkus failed to startup (if migrate on start is set) with:

org.flywaydb.core.api.FlywayException: Unable to obtain inputstream for resource: sql/V1_0_0_001__DoNothing.sql
        at org.flywaydb.core.internal.resource.classpath.ClassPathResource.read(ClassPathResource.java:90)
        at org.flywaydb.core.internal.resolver.ChecksumCalculator.calculateChecksumForResource(ChecksumCalculator.java:67)
        at org.flywaydb.core.internal.resolver.ChecksumCalculator.calculate(ChecksumCalculator.java:46)
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.getChecksumForLoadableResource(SqlMigrationResolver.java:143)
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.addMigrations(SqlMigrationResolver.java:181)
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:88)
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:44)
        at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.collectMigrations(CompositeMigrationResolver.java:127)
        at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:109)
        at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:95)
        at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:46)
        at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:130)
        at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:185)
        at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54)
        at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:162)
        at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:159)
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:71)
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99)
        at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:140)
        at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:159)
        at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:137)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:206)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:158)
        at org.flywaydb.core.Flyway.execute(Flyway.java:527)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:158)
        at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:54)
        at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions-1520831253.deploy_0(FlywayProcessor$createBeansAndStartActions-1520831253.zig:80)
        at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions-1520831253.deploy(FlywayProcessor$createBeansAndStartActions-1520831253.zig:40)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:521)
        at io.quarkus.runtime.Application.start(Application.java:90)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:92)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:145)
        at java.base/java.lang.Thread.run(Thread.java:834)

Configuration

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=postgres
quarkus.datasource.password=postgres
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase
quarkus.flyway.migrate-at-start=true
quarkus.flyway.baseline-on-migrate=true
quarkus.flyway.schemas=public
quarkus.flyway.locations=sql
@mqs24d mqs24d added the kind/bug Something isn't working label Aug 8, 2020
gsmet added a commit to gsmet/quarkus that referenced this issue Aug 10, 2020
@gsmet gsmet self-assigned this Aug 10, 2020
@gsmet
Copy link
Member

gsmet commented Aug 10, 2020

I confirm we have a bug. I created #11300 to fix it.

Will get it in 1.7.1.

gsmet added a commit to gsmet/quarkus that referenced this issue Aug 10, 2020
@gsmet gsmet added this to the 1.7.1.Final milestone Aug 24, 2020
gsmet added a commit to gsmet/quarkus that referenced this issue Aug 24, 2020
gsmet added a commit to gsmet/quarkus that referenced this issue Aug 24, 2020
gsmet added a commit to gsmet/quarkus that referenced this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants