From 149885661b5f54d451b4912ad73a03b344c0336b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 00:20:15 +0100 Subject: [PATCH] Update flyway.version to v10 (release/2.1.x) (major) (#522) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jochen Schalanda --- .github/workflows/build.yml | 2 +- .java-version | 2 +- README.md | 55 +++++++++++-------- pom.xml | 21 +++---- .../io/dropwizard/flyway/FlywayFactory.java | 46 ---------------- .../dropwizard/flyway/FlywayFactoryTest.java | 2 +- 6 files changed, 45 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fc04e8..33c7d9c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - java-version: ['11', '17', '21'] + java-version: ['17', '21'] uses: dropwizard/workflows/.github/workflows/maven.yml@main secrets: inherit with: diff --git a/.java-version b/.java-version index 6259340..8e2afd3 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -1.8 +17 \ No newline at end of file diff --git a/README.md b/README.md index 72cb92c..7571729 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Dropwizard Flyway ================= -[![Build](https://github.com/dropwizard/dropwizard-flyway/workflows/Build/badge.svg)](https://github.com/dropwizard/dropwizard-flyway/actions?query=workflow%3ABuild) +[![Build](https://github.com/dropwizard/dropwizard-flyway/actions/workflows/build.yml/badge.svg)](https://github.com/dropwizard/dropwizard-flyway/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dropwizard_dropwizard-flyway&metric=alert_status)](https://sonarcloud.io/dashboard?id=dropwizard_dropwizard-flyway) [![Maven Central](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway.svg)](https://search.maven.org/artifact/io.dropwizard.modules/dropwizard-flyway) @@ -11,7 +11,7 @@ Dropwizard Flyway Usage ----- -Just add the `FlywayBundle` to your Dropwizard application inside the [`Application#initialize`](https://javadoc.io/static/io.dropwizard/dropwizard-core/2.0.0/io/dropwizard/Application.html#initialize-io.dropwizard.setup.Bootstrap-) method. +Just add the `FlywayBundle` to your Dropwizard application inside the [`Application#initialize`](https://javadoc.io/static/io.dropwizard/dropwizard-core/4.0.0/io/dropwizard/core/Application.html#initialize(io.dropwizard.core.setup.Bootstrap) method. @Override public void initialize(Bootstrap bootstrap) { @@ -47,9 +47,9 @@ The [Flyway migrations](http://flywaydb.org/documentation/migration/) must be ac Configuration ------------- -`dropwizard-flyway` is using the standard [DataSourceFactory](https://javadoc.io/static/io.dropwizard/dropwizard-db/2.0.0/io/dropwizard/db/DataSourceFactory.html) from [`dropwizard-db`](https://javadoc.io/doc/io.dropwizard/dropwizard-db/2.0.0/index.html) for configuring its [DataSource](http://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html). +`dropwizard-flyway` is using the standard [DataSourceFactory](https://javadoc.io/static/io.dropwizard/dropwizard-db/4.0.0/io/dropwizard/db/DataSourceFactory.html) from [`dropwizard-db`](https://javadoc.io/doc/io.dropwizard/dropwizard-db/4.0.0/index.html) for configuring its [DataSource](http://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html). -Additionally you can override the following configuration settings of Flyway using [FlywayFactory](https://dropwizard.github.io/dropwizard-flyway/2.0.0-1/apidocs/io/dropwizard/flyway/FlywayFactory.html): +Additionally, you can override the following configuration settings of Flyway using [FlywayFactory](https://dropwizard.github.io/dropwizard-flyway/2.0.0-1/apidocs/io/dropwizard/flyway/FlywayFactory.html): flyway: # The encoding of SQL migrations. (default: UTF-8) @@ -120,7 +120,7 @@ Additionally you can override the following configuration settings of Flyway usi # Ignore migrations that match this list of patterns when validating migrations. # Each pattern is of the form described type:status with * matching type or status. - # Please refer to https://flywaydb.org/documentation/configuration/parameters/ignoreMigrationPatterns for details. + # Please refer to https://documentation.red-gate.com/fd/flyway-cli-and-api/configuration/parameters/flyway/ignore-migration-patterns for details. # Example: repeatable:missing,versioned:pending,*:failed (default: *:future) ignoreMigrationPatterns: - "*:future" @@ -143,7 +143,11 @@ Additionally you can override the following configuration settings of Flyway usi # If set to true, default built-in resolvers (jdbc, spring-jdbc and sql) are skipped and only custom resolvers as # defined by 'resolvers' are used. (default: false) skipDefaultResolvers: false - + + # The map of to overwrite any existing configuration. (default: empty map) + # Properties are documented here: https://documentation.red-gate.com/fd/parameters-224919673.html + configuration: + #### COMMERCIAL FEATURES # (Flyway Pro and Flyway Enterprise only) @@ -172,44 +176,47 @@ Additionally you can override the following configuration settings of Flyway usi # the following errorOverride can be used: 99999:17110:E #errorOverrides: - # Whether to Flyway's support for Oracle SQL*Plus commands should be activated. (default: false) - oracleSqlPlus: false - # Whether to stream SQL migrations when executing them. (default: false) stream: false # Target version up to which Flyway should consider migrations. # The special value 'current' designates the current version of the schema. (default: <>) #target: - - # The file name prefix for undo SQL migrations. (default: U) - # Undo SQL migrations are responsible for undoing the effects of the versioned migration with the same version. - # They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , - # which using the defaults translates to U1.1__My_description.sql - undoSqlMigrationPrefix: U - - # The map of to overwrite any existing configuration. (default: empty map) - # Properties are documented here: https://documentation.red-gate.com/fd/parameters-184127474.html - configuration: - Maven Artifacts --------------- -![dropwizard-flyway 1.3.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/1.3) -![dropwizard-flyway 2.0.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/2.0) ![dropwizard-flyway 2.1.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/2.1) +![dropwizard-flyway 3.0.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/3.0) +![dropwizard-flyway 4.0.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/4.0) This project is available on Maven Central. To add it to your project simply add the following dependencies to your `pom.xml`: - io.dropwizard.modules dropwizard-flyway ${dropwizard-flyway.version} +Please note that you will need to add the respective Flyway database support artifacts and configure them via the `flyway.configuration` map. + +Example: + +Add Flyway PostgreSQL dependency to your POM: + + + org.flywaydb + flyway-database-postgresql + ${flyway.version} + + +Add the configuration setting to your `flyway.configuration` block: + + flyway: + configuration: + # PostgreSQL Transactional Lock, see https://documentation.red-gate.com/fd/postgresql-transactional-lock-224919738.html + flyway.postgresql.transactional.lock: false Support ------- @@ -220,7 +227,7 @@ Please file bug reports and feature requests in [GitHub issues](https://github.c License ------- -Copyright (c) 2014-2020 Jochen Schalanda, Dropwizard Team +Copyright (c) 2014-2024 Jochen Schalanda, Dropwizard Team This library is licensed under the Apache License, Version 2.0. diff --git a/pom.xml b/pom.xml index ad514ca..10f96fa 100644 --- a/pom.xml +++ b/pom.xml @@ -27,8 +27,8 @@ - Travis CI - https://travis-ci.org/dropwizard/dropwizard-flyway + GitHub Actions + https://github.com/dropwizard/dropwizard-flyway/actions @@ -62,14 +62,15 @@ UTF-8 UTF-8 - 8 + 17 + true dropwizard_dropwizard-flyway dropwizard https://sonarcloud.io 2.1.12 - 9.22.3 + 10.7.2 @@ -102,12 +103,6 @@ flyway-core ${flyway.version} - - org.flywaydb - flyway-database-oracle - ${flyway.version} - true - com.google.code.findbugs jsr305 @@ -139,6 +134,12 @@ mockito-junit-jupiter test + + org.flywaydb + flyway-database-postgresql + ${flyway.version} + test + com.h2database h2 diff --git a/src/main/java/io/dropwizard/flyway/FlywayFactory.java b/src/main/java/io/dropwizard/flyway/FlywayFactory.java index f43dd33..0337ef2 100644 --- a/src/main/java/io/dropwizard/flyway/FlywayFactory.java +++ b/src/main/java/io/dropwizard/flyway/FlywayFactory.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.flywaydb.core.Flyway; import org.flywaydb.core.api.configuration.FluentConfiguration; -import org.flywaydb.database.oracle.OracleConfigurationExtension; import javax.annotation.Nullable; import javax.sql.DataSource; @@ -105,17 +104,10 @@ public class FlywayFactory { private List errorOverrides; @JsonProperty @Nullable - private Boolean oracleSqlPlus; - @JsonProperty - @Nullable private Boolean stream; @JsonProperty @Nullable private String target; - @JsonProperty - @Nullable - private String undoSqlMigrationPrefix; - @JsonProperty @Nullable Map configuration = Collections.emptyMap(); @@ -574,21 +566,6 @@ public void setErrorOverrides(@Nullable List errorOverrides) { this.errorOverrides = errorOverrides; } - /** - * @see OracleConfigurationExtension#getSqlplus() - */ - @Nullable - public Boolean isOracleSqlPlus() { - return oracleSqlPlus; - } - - /** - * @see OracleConfigurationExtension#setSqlplus(Boolean) - */ - public void setOracleSqlPlus(@Nullable Boolean oracleSqlPlus) { - this.oracleSqlPlus = oracleSqlPlus; - } - /** * @see FluentConfiguration#isStream() */ @@ -619,21 +596,6 @@ public void setTarget(@Nullable String target) { this.target = target; } - /** - * @see FluentConfiguration#getUndoSqlMigrationPrefix() - */ - @Nullable - public String getUndoSqlMigrationPrefix() { - return undoSqlMigrationPrefix; - } - - /** - * @see FluentConfiguration#undoSqlMigrationPrefix(String) - */ - public void setUndoSqlMigrationPrefix(@Nullable String undoSqlMigrationPrefix) { - this.undoSqlMigrationPrefix = undoSqlMigrationPrefix; - } - /** * @see FluentConfiguration#configuration(Map) */ @@ -705,20 +667,12 @@ private FluentConfiguration createConfiguration() { if (errorOverrides != null) { flyway.errorOverrides(errorOverrides.toArray(emptyStringArray)); } - if (oracleSqlPlus != null) { - OracleConfigurationExtension oracleConfigurationExtension = - flyway.getPluginRegister().getPlugin(OracleConfigurationExtension.class); - oracleConfigurationExtension.setSqlplus(oracleSqlPlus); - } if (stream != null) { flyway.stream(stream); } if (target != null) { flyway.target(target); } - if (undoSqlMigrationPrefix != null) { - flyway.undoSqlMigrationPrefix(undoSqlMigrationPrefix); - } return flyway; } diff --git a/src/test/java/io/dropwizard/flyway/FlywayFactoryTest.java b/src/test/java/io/dropwizard/flyway/FlywayFactoryTest.java index f33cf6a..8e40599 100644 --- a/src/test/java/io/dropwizard/flyway/FlywayFactoryTest.java +++ b/src/test/java/io/dropwizard/flyway/FlywayFactoryTest.java @@ -2,7 +2,7 @@ import com.google.common.collect.ImmutableMap; import org.flywaydb.core.Flyway; -import org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension; +import org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension; import org.h2.jdbcx.JdbcDataSource; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test;