spring-io / start.spring.io

https://start.spring.io
Apache License 2.0
2.22k stars 905 forks source link

Add dependency on database-specific Flyway module when both Flyway and SQL Server or Oracle are selected #1349

Closed zakaria-shahen closed 11 months ago

zakaria-shahen commented 11 months ago

when select spring boot 3.2.0-RC2 and flyway 9.22 and DB Driver Then should be added automatically org.flywaydb:flyway-database-<NAME> dependency

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

Example:

        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-database-oracle</artifactId>
        </dependency>

else will be throw next exception

DB Driver: com.oracle.database.jdbc:ojdbc8 Flyway version: 9.22.3 Spring boot: 3.1.0-RC2

Caused by: org.flywaydb.core.api.FlywayException: Unsupported Database: Oracle 18.0
    at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:105) ~[flyway-core-9.22.3.jar:na]
    at org.flywaydb.core.api.configuration.ClassicConfiguration.setDataSource(ClassicConfiguration.java:1095) ~[flyway-core-9.22.3.jar:na]
    at org.flywaydb.core.api.configuration.FluentConfiguration.dataSource(FluentConfiguration.java:624) ~[flyway-core-9.22.3.jar:na]
    at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.configureDataSource(FlywayAutoConfiguration.java:185) ~[spring-boot-autoconfigure-3.2.0-RC2.jar:3.2.0-RC2]
    at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.flyway(FlywayAutoConfiguration.java:172) ~[spring-boot-autoconfigure-3.2.0-RC2.jar:3.2.0-RC2]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.0-RC2.jar:6.1.0-RC2]
    ... 39 common frames omitted
wilkinsona commented 11 months ago

Thanks for the suggestion. The reference is about Flyway 10 that has introduced many more flyway-database-* modules. The only one that exists in Flyway 9 is flyway-database-oracle. There's also flyway-sqlserver. We could add support for both of those and the rest whenever Spring Boot upgrades to Flyway 10+.

wilkinsona commented 11 months ago

We already do this:

There's nothing actionable at this time for Flyway 10 so I'm going to close this one. We can revisit this as and when Spring Boot upgrades to Flyway 10+.