Skip to content

Commit

Permalink
fix: Update dependency org.flywaydb:flyway-core to v10 (#153)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Flyway 10.0.0 doesn't include Postgres plugin in the `core` artifact anymore

Whenever you provide another Flyway version via `jooqCodegen` configuration, make sure to include `org.flywaydb:flyway-database-postgresql` dependency in addition to `org.flywaydb:flyway-core`, otherwise you might get an error like this:
```
org.flywaydb.core.api.FlywayException: No database found to handle jdbc:postgresql://localhost:32798/postgres
```
  • Loading branch information
renovate[bot] authored Nov 4, 2023
1 parent 8ec7050 commit cc05be3
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ dependencies {
implementation("org.jooq:jooq:${RecommendedVersions.JOOQ_VERSION}")
jooqCodegen("org.postgresql:postgresql:42.3.6")
jooqCodegen("org.flywaydb.enterprise:flyway-core:${RecommendedVersions.FLYWAY_VERSION}")
jooqCodegen("org.flywaydb:flyway-database-postgresql:${RecommendedVersions.FLYWAY_VERSION}")
}
```

Expand Down Expand Up @@ -411,6 +412,7 @@ dependencies {
jooqCodegen("org.postgresql:postgresql:42.3.6")
jooqCodegen("mysql:mysql-connector-java:8.0.29")
jooqCodegen("org.flywaydb:flyway-mysql:${RecommendedVersions.FLYWAY_VERSION}")
jooqCodegen("org.flywaydb:flyway-database-postgresql:${RecommendedVersions.FLYWAY_VERSION}")
implementation("org.jooq:jooq:3.16.6")
}
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
* transitive. This is a quirk of the shadow plugin.
*/
shadow(libs.jooq.codegen)
shadow(libs.flyway.core)
shadow(libs.bundles.flyway)

implementation(libs.testcontainers.jdbc) {
exclude(group = libs.jna.get().group) // cannot be shadowed
Expand Down
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/coverage-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.lang.Thread.sleep
import java.time.Duration

plugins {
kotlin("jvm")
jacoco
Expand All @@ -12,4 +15,13 @@ tasks {
}
dependsOn(withType<Test>())
}

withType<Test> {
// workaround for https://github.com/gradle/gradle/issues/16603
doLast {
sleep(
Duration.ofSeconds(2).toMillis()
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ repositories {
}

dependencies {
implementation("org.flywaydb:flyway-core:$FLYWAY_VERSION")
compileOnly("org.flywaydb:flyway-core:$FLYWAY_VERSION")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ repositories {
}

dependencies {
implementation("org.flywaydb:flyway-core:$FLYWAY_VERSION")
compileOnly("org.flywaydb:flyway-core:$FLYWAY_VERSION")
implementation("org.apache.commons:commons-lang3:3.12.0")
}
9 changes: 8 additions & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[versions]
jooq = "3.18.7"
flyway = "9.22.3"
flyway = "10.0.0"
testcontainers = "1.19.1"
jna = "5.13.0"

[libraries]
jooq-codegen = { module = "org.jooq:jooq-codegen", version.ref = "jooq" }
flyway-core = { module = "org.flywaydb:flyway-core", version.ref = "flyway" }
flyway-database-postgres = { module = "org.flywaydb:flyway-database-postgresql", version.ref = "flyway" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
testcontainers-jdbc = { module = "org.testcontainers:jdbc", version.ref = "testcontainers" }

Expand All @@ -21,3 +22,9 @@ gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.2.1"
shadow = "com.github.johnrengelman:shadow:8.1.1"
jacoco-testkit = "pl.droidsonroids.gradle.jacoco:pl.droidsonroids.gradle.jacoco:1.0.12"
nexus-publish = "io.github.gradle-nexus:publish-plugin:1.3.0"

[bundles]
flyway = [
"flyway-core",
"flyway-database-postgres"
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class FlywayVersionConfigurationJooqDockerPluginFunctionalTest : JooqDockerPlugi
dependencies {
jooqCodegen("org.flywaydb:flyway-core:${'$'}{RecommendedVersions.FLYWAY_VERSION}")
jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}{RecommendedVersions.FLYWAY_VERSION}")
jooqCodegen("org.postgresql:postgresql:42.3.6")
}
""".trimIndent()
Expand All @@ -47,7 +48,7 @@ class FlywayVersionConfigurationJooqDockerPluginFunctionalTest : JooqDockerPlugi
}

@ParameterizedTest
@ValueSource(strings = ["8.5.12", "8.4.4", "8.0.5", "7.15.0"])
@ValueSource(strings = ["9.22.3", "8.5.12", "8.4.4", "8.0.5", "7.15.0"])
fun `should be possible to specify Flyway version to use`(flywayVersion: String) {
// given
prepareBuildGradleFile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class JavaBasedMigrationsFunctionalTest : JooqDockerPluginFunctionalTestBase() {
}
dependencies {
implementation("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION")
compileOnly("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION")
}
""".trimIndent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class MultipleDatabasesJooqDockerPluginFunctionalTest : JooqDockerPluginFunction
jooqCodegen("org.postgresql:postgresql:42.3.6")
jooqCodegen("mysql:mysql-connector-java:8.0.29")
jooqCodegen("org.flywaydb:flyway-mysql:${'$'}{RecommendedVersions.FLYWAY_VERSION}")
jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}{RecommendedVersions.FLYWAY_VERSION}")
implementation("org.jooq:jooq:${'$'}{RecommendedVersions.JOOQ_VERSION}")
}
""".trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class NoMigrationsFunctionalTest : JooqDockerPluginFunctionalTestBase() {
dependencies {
jooqCodegen("org.flywaydb:flyway-core:${'$'}FLYWAY_VERSION")
jooqCodegen("org.flywaydb:flyway-database-postgresql:${'$'}FLYWAY_VERSION")
jooqCodegen("org.postgresql:postgresql:42.3.6")
}
""".trimIndent()
Expand Down

0 comments on commit cc05be3

Please sign in to comment.