Skip to content

Commit

Permalink
Update flyway.version to v10 (release/2.1.x) (major) (#522)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jochen Schalanda <[email protected]>
  • Loading branch information
renovate[bot] and joschi authored Feb 8, 2024
1 parent 7e53e15 commit 1498856
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8
17
55 changes: 31 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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<MyConfiguration> bootstrap) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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 <flywaySetting, appliedValue> 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)
Expand Down Expand Up @@ -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: <<latest version>>)
#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 <flywaySetting, appliedValue> 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`:


<dependency>
<groupId>io.dropwizard.modules</groupId>
<artifactId>dropwizard-flyway</artifactId>
<version>${dropwizard-flyway.version}</version>
</dependency>

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:

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

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
-------
Expand All @@ -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.

Expand Down
21 changes: 11 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
</scm>

<ciManagement>
<system>Travis CI</system>
<url>https://travis-ci.org/dropwizard/dropwizard-flyway</url>
<system>GitHub Actions</system>
<url>https://github.com/dropwizard/dropwizard-flyway/actions</url>
</ciManagement>

<issueManagement>
Expand Down Expand Up @@ -62,14 +62,15 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.parameters>true</maven.compiler.parameters>

<sonar.projectKey>dropwizard_dropwizard-flyway</sonar.projectKey>
<sonar.organization>dropwizard</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<dropwizard.version>2.1.12</dropwizard.version>
<flyway.version>9.22.3</flyway.version>
<flyway.version>10.7.2</flyway.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -102,12 +103,6 @@
<artifactId>flyway-core</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-oracle</artifactId>
<version>${flyway.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down Expand Up @@ -139,6 +134,12 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>${flyway.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
46 changes: 0 additions & 46 deletions src/main/java/io/dropwizard/flyway/FlywayFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -105,17 +104,10 @@ public class FlywayFactory {
private List<String> errorOverrides;
@JsonProperty
@Nullable
private Boolean oracleSqlPlus;
@JsonProperty
@Nullable
private Boolean stream;
@JsonProperty
@Nullable
private String target;
@JsonProperty
@Nullable
private String undoSqlMigrationPrefix;

@JsonProperty
@Nullable
Map<String, String> configuration = Collections.emptyMap();
Expand Down Expand Up @@ -574,21 +566,6 @@ public void setErrorOverrides(@Nullable List<String> 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()
*/
Expand Down Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/dropwizard/flyway/FlywayFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1498856

Please sign in to comment.