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

📢 Modular Flyway V10 (No database found to handle or Unsupported Database) #3780

Open
Barry-RG opened this issue Nov 1, 2023 · 11 comments

Comments

@Barry-RG
Copy link
Contributor

Barry-RG commented Nov 1, 2023

It has come to our attention that the move to a more modular Flyway in version V10.0.0 may not have been made clear enough in our release notes.

As we attempt to move towards a much wider range of supported databases and database types we have found ourselves needing to extract database support out from flyway-core and into their own modules in order to improve maintainability and distribution size.

As a result, databases, with the exception of in-memory or file databases such as H2 or SQLite, have been moved into their own packages which need to be added to your project when upgrading to Flyway V10.0.0. This includes whether you are using Flyway as a dependency in your project or using the Gradle or Maven plugins.

The list of additional dependencies can be seen below:

  • org.flywaydb:flyway-database-db2
  • org.flywaydb:flyway-database-derby
  • org.flywaydb:flyway-database-hsqldb
  • org.flywaydb:flyway-database-informix
  • org.flywaydb:flyway-database-postgresql
  • org.flywaydb:flyway-database-oracle
  • org.flywaydb:flyway-database-redshift
  • org.flywaydb:flyway-database-saphana
  • org.flywaydb:flyway-database-snowflake
  • org.flywaydb:flyway-database-sybasease
  • org.flywaydb:flyway-firebird
  • org.flywaydb:flyway-gcp-bigquery
  • org.flywaydb:flyway-gcp-spanner
  • org.flywaydb:flyway-mysql
  • org.flywaydb:flyway-singlestore
  • org.flywaydb:flyway-sqlserver

If you are using any of the databases affected, please include the corresponding dependency in your project.

We are expecting that by structuring Flyway in to purposeful dependencies that we can both give developers more control of what aspects of Flyway they include in their project but also allow us to more fluently accept contributions and desired functionality from our community.

For more information on our on going goal to improve Flyway's open source version please see the following blog.

@lachezar
Copy link

lachezar commented Nov 1, 2023

Thank you for preemptively opening this issue. I was about to open issue myself when I saw it 🙈

@davinkevin
Copy link

It could be cool to update the documentation for common used database (postgresql, mysql…) and with common build tools (gradle, maven), because the current documentation is still on 9.19 😅.

In my specific case, I've tried for gradle build tool, but without success in my module.

I tried to add implementation("org.flywaydb:flyway-database-postgresql:10.0.0") in the dependencies block, but with the same error/result when I run :flywayMigrate task

Additionally, I would like to have this dependency ONLY during task execution. Except if I'm wrong, the flyway plugin doesn't have a custom dep definition (like the jooq plugin in my example), it means to me I'll have to carry this dependency in my application… even if I don't use it !? 🤔.

@Barry-RG
Copy link
Contributor Author

Barry-RG commented Nov 6, 2023

It could be cool to update the documentation for common used database (postgresql, mysql…) and with common build tools (gradle, maven), because the current documentation is still on 9.19 😅.

@davinkevin Can you please point me to the URL that is still on 9.19?

@davinkevin
Copy link

It could be cool to update the documentation for common used database (postgresql, mysql…) and with common build tools (gradle, maven), because the current documentation is still on 9.19 😅.

@davinkevin Can you please point me to the URL that is still on 9.19?

https://documentation.red-gate.com/fd/quickstart-gradle-184127577.html 😇

@thetaurean
Copy link

thetaurean commented Nov 15, 2023

It could be cool to update the documentation for common used database (postgresql, mysql…) and with common build tools (gradle, maven), because the current documentation is still on 9.19 😅.

In my specific case, I've tried for gradle build tool, but without success in my module.

I tried to add implementation("org.flywaydb:flyway-database-postgresql:10.0.0") in the dependencies block, but with the same error/result when I run :flywayMigrate task

Additionally, I would like to have this dependency ONLY during task execution. Except if I'm wrong, the flyway plugin doesn't have a custom dep definition (like the jooq plugin in my example), it means to me I'll have to carry this dependency in my application… even if I don't use it !? 🤔.

This also seems broken for us

No database found to handle jdbc:postgresql://localhost:5432/prime_data_hub

The appropriate dependency has been added:

    implementation("org.flywaydb:flyway-core:10.0.1")
    implementation("org.flywaydb:flyway-database-postgresql:10.0.1")

I noticed this in the release notes:

Notes
Flyway Gradle Plugin is currently unable to be released.

Am I correct in assuming we are waiting for the gradle plugin to be released?

vrajmohan added a commit to codeforamerica/form-flow that referenced this issue Nov 15, 2023
10.0 seems to have introduced breaking changes.
See flyway/flyway#3780
vrajmohan added a commit to codeforamerica/form-flow that referenced this issue Nov 15, 2023
10.0 seems to have introduced breaking changes.
See flyway/flyway#3780
@sansnom
Copy link

sansnom commented Nov 17, 2023

For gradle, you need to follow the documentation. 😄

The dependency MUST be added inside the buildscript. Example for postgresql:

buildscript {
    dependencies {
        classpath "org.flywaydb:flyway-database-postgresql:10.0.0"
    }
}

vrajmohan added a commit to codeforamerica/form-flow that referenced this issue Nov 17, 2023
10.0 seems to have introduced breaking changes.
See flyway/flyway#3780
@thetaurean
Copy link

thetaurean commented Nov 20, 2023

For gradle, you need to follow the documentation. 😄

The dependency MUST be added inside the buildscript. Example for postgresql:

buildscript {
    dependencies {
        classpath "org.flywaydb:flyway-database-postgresql:10.0.0"
    }
}

Thanks for calling this out! Not sure how I missed it 🤦

@davinkevin this may solve your issue as well. In our case I had to add parens to the snippet as seen below:

buildscript {
    dependencies {
        classpath("org.flywaydb:flyway-database-postgresql:10.0.0")
    }
}

@davinkevin
Copy link

I confirm it worked for me, but it's not a very good pattern for gradle build tool. By doing that, all flyway dependencies leak to the build classpath, for all plugins.

The best solution would be to declare a dedicated configuration used by the plugin and which can be declared by a dedicated element in the dependencies block, like done by the jooq plugin.

It could be like this for flyway, which is better for configuration and good to avoid conflicts between plugin dependencies.

dependencies {
    flyway("org.flywaydb:flyway-database-postgresql:10.0.0")
}

@Barry-RG
Copy link
Contributor Author

@davinkevin thank you for your suggestion, that is something we may look into

@Jukurrpa
Copy link

Hello, adding the dependencies to flyway-mysql and flyway-database-postgresql did not solve the issue in our case.

We're running Flyway in an AWS Lambda using a JAR created with the maven shade plugin. All the dependencies are in the pom.xml as below (we're using version 10.11.1). The database type are present when the lambda is running (we can log their class name). Despite all of this, we keep getting No database found to handle jdbc:postgresql: and the MySQL equivalent.

Is there something specific to do for Lambdas?

        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>${flyway.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-database-postgresql</artifactId>
            <version>${flyway.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-mysql</artifactId>
            <version>${flyway.version}</version>
        </dependency>

@Lob2018
Copy link

Lob2018 commented May 1, 2024

For Flyway versions higher than 10 with Maven Shade, <transformerimplementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> is needed because it uses Service Loader and no longer Java reflection. From my Stack Overflow question and answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment