Skip to content

Commit

Permalink
Bump version to flyway-9.16.2
Browse files Browse the repository at this point in the history
Add slf4j-nop dependency to flyway-commandline to remove unwanted SLF4J messages on stderr
Closes #3636, Closes #3645: EnvironmentModel: swap back connectRetries and connectRetriesInterval default values
Reduce allocations from class loading through FeatureDetector
Update msal4j to fix SNYK-JAVA-NETMINIDEV-3369748
Fix Testcontainers typos
Prevent unnecessary statements in RedshiftDatabaseType
  • Loading branch information
Barry-RG committed Apr 4, 2023
1 parent 08ff5b0 commit 8e3af28
Show file tree
Hide file tree
Showing 53 changed files with 788 additions and 79 deletions.
1 change: 0 additions & 1 deletion documentation/Flyway CLI and API/Commands/Check.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ For `-changes` and `-drift`, Flyway migrates against a build database and compar
You can read more about the `check` concept [here](Concepts/Check Concept).

#### Requirements
- .NET 6 is required in order to generate reports. You can download it from [here](https://dotnet.microsoft.com/en-us/download/dotnet/6.0).
- `sqlfluff` is required for Code Analysis (`-code`). You can install it by running `pip3 install sqlfluff==1.2.1` or use the `redgate/flyway` Docker image that has `sqlfluff` pre-installed.

#### Flags:
Expand Down
4 changes: 0 additions & 4 deletions documentation/Flyway CLI and API/Commands/Snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ subtitle: snapshot
This can be used to generate a snapshot of your database in its current state for use with [`check.deployedSnapshot`](Commands/check#configuration-parameters)
or to take a snapshot of a build database for use with [`check.nextSnapshot`](Commands/check#configuration-parameters)

#### Requirements

- .NET 6 is required in order to generate reports. You can download it from [here](https://dotnet.microsoft.com/en-us/download/dotnet/6.0).

#### Configuration parameters:

_Format: -key=value_
Expand Down
1 change: 0 additions & 1 deletion documentation/Flyway CLI and API/Concepts/Check concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Flyway's `check -drift` will then:
## Good things to know
- There is no requirement for the build database to be in your production system
- Please note that the build database **may be cleaned** before the operation starts
- The underlying comparison technology is dependent on [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) which is why this is required
- If you get an ERROR: Invalid argument: -check, this is because some systems do not like the period in the argument. You can wrap the arguments in a single or double quotes. Eg, -'check.buildURL'

## `Check -code`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ flyway.locations=filesystem:sql
#
# auto: Auto detect the logger (default behavior)
# console: Use stdout/stderr (only available when using the CLI)
# slf4j2: Use the slf4j2 logger
# slf4j: Use the slf4j logger
# log4j2: Use the log4j2 logger
# apache-commons: Use the Apache Commons logger
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This can be useful when a dependency comes with a logger you do not wish to use.

* `auto` - Auto detect the logger (default behavior)
* `console` - Use stdout/stderr (_only available when using CLI_)
* `slf4j2` - Use the slf4j2 logger
* `slf4j` - Use the slf4j logger
* `log4j2` - Use the log4j2 logger
* `apache-commons` - Use the Apache Commons logger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ jdbc:tc:postgresql:11-alpine://localhost:5432/databasename

## Limitations

- If Flyway doesn't ship with a database driver for your chosen database, you will still need to provide one in order to use it with Testcontainers. For example, if you want to connect to a DB2 database with TestContainers you will still need to provide a DB2 driver whose Maven Central coordinates are <code>com.ibm.db2.jcc:11.5.0.0</code>
- If Flyway doesn't ship with a database driver for your chosen database, you will still need to provide one in order to use it with Testcontainers. For example, if you want to connect to a DB2 database with Testcontainers you will still need to provide a DB2 driver whose Maven Central coordinates are <code>com.ibm.db2.jcc:11.5.0.0</code>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,38 @@
</div>
<div class="col-md-9">

<div class="release">
<h2 id="9.16.2">Flyway 9.16.2 (2023-04-04)</h2>

<h3>Bug fixes</h3>
<ul>
<li>Removed unwanted SLF4J messages on stderr</li>
<li>
<a href="https://github.com/flyway/flyway/issues/3636">Issue 3636</a>
EnvironmentModel: swap back connectRetries and connectRetriesInterval default values
</li>
</ul>

<h3>Changes</h3>
<ul>
<li>Updated Postgres password change regex to use latest form</li>
</ul>

<h3>Java compatibility</h3>
<ul>
<li>Update msal4j to fix SNYK-JAVA-NETMINIDEV-3369748</li>
</ul>

<h3>Performance improvements</h3>
<ul>
<li>Reduce allocations from class loading through FeatureDetector</li>
</ul>

<p>
Thanks to mihalyr for reporting these issues.
</p>
</div>

<div class="release">
<h2 id="9.16.0">Flyway 9.16.0 (2023-03-15)</h2>

Expand Down
2 changes: 1 addition & 1 deletion documentation/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

flywayVersion: 9.16.1
flywayVersion: 9.16.2
enterpriseUrl: https://download.red-gate.com/maven/release/org/flywaydb/enterprise
kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
Expand Down
10 changes: 8 additions & 2 deletions flyway-commandline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-parent</artifactId>
<version>9.16.1</version>
<version>9.16.2</version>
</parent>
<artifactId>flyway-commandline</artifactId>
<packaging>jar</packaging>
Expand All @@ -30,7 +30,7 @@



<flyway-gcp-spanner.version>9.16.1-beta</flyway-gcp-spanner.version>
<flyway-gcp-spanner.version>9.16.2-beta</flyway-gcp-spanner.version>
<jre.version>17.0.5</jre.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -305,6 +305,11 @@
<artifactId>commons-text</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<scope>runtime</scope>
</dependency>



Expand Down Expand Up @@ -599,6 +604,7 @@






</plugins>
Expand Down
10 changes: 2 additions & 8 deletions flyway-commandline/src/main/assembly/component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@














Expand Down Expand Up @@ -163,6 +155,7 @@
<includes>
<include>org.apache.commons:commons-text</include>
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-toml</include>
<include>org.slf4j:slf4j-nop</include>
</includes>
</dependencySet>
<dependencySet>
Expand Down Expand Up @@ -281,6 +274,7 @@
<exclude>org.fusesource.jansi:jansi</exclude>
<exclude>com.google.code.gson:gson</exclude>
<exclude>software.amazon.awssdk:s3</exclude>
<exclude>org.slf4j:slf4j-nop</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand Down
2 changes: 1 addition & 1 deletion flyway-commandline/src/main/assembly/flyway.conf
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ flyway.locations=filesystem:sql
#
# auto: Auto detect the logger (default behavior)
# console: Use stdout/stderr (only available when using the CLI)
# slf4j2: Use the slf4j2 logger
# slf4j: Use the slf4j logger
# log4j2: Use the log4j2 logger
# apache-commons: Use the Apache Commons logger
#
Expand Down
10 changes: 10 additions & 0 deletions flyway-commandline/src/main/assembly/linux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@
<outputDirectory>jre</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<!-- [teams] -->
<fileSet>
<directory>../flyway-rgcompare/src/main/resources/rgcompare/linux-x64</directory>
<outputDirectory>lib/rgcompare</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<!-- [/teams] -->
</fileSets>
</assembly>
10 changes: 10 additions & 0 deletions flyway-commandline/src/main/assembly/macos-arm64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@
<outputDirectory>jre</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<!-- [teams] -->
<fileSet>
<directory>../flyway-rgcompare/src/main/resources/rgcompare/macos-arm64</directory>
<outputDirectory>lib/rgcompare</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<!-- [/teams] -->
</fileSets>
</assembly>
10 changes: 10 additions & 0 deletions flyway-commandline/src/main/assembly/macos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@
<outputDirectory>jre</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
<!-- [teams] -->
<fileSet>
<directory>../flyway-rgcompare/src/main/resources/rgcompare/macos-x64</directory>
<outputDirectory>lib/rgcompare</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<!-- [/teams] -->
</fileSets>
</assembly>
12 changes: 12 additions & 0 deletions flyway-commandline/src/main/assembly/no-jre.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@
<componentDescriptors>
<componentDescriptor>src/main/assembly/component.xml</componentDescriptor>
</componentDescriptors>
<!-- [teams] -->
<fileSets>
<fileSet>
<directory>../flyway-rgcompare/src/main/resources/rgcompare/linux-x64</directory>
<outputDirectory>lib/rgcompare</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<!-- [/teams] -->
</assembly>
10 changes: 10 additions & 0 deletions flyway-commandline/src/main/assembly/windows.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
<outputDirectory>jre</outputDirectory>
<fileMode>644</fileMode>
</fileSet>
<!-- [teams] -->
<fileSet>
<directory>../flyway-rgcompare/src/main/resources/rgcompare/windows-x64</directory>
<outputDirectory>lib/rgcompare</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<fileMode>644</fileMode>
</fileSet>
<!-- [/teams] -->
</fileSets>
<files>
<file>
Expand Down
55 changes: 44 additions & 11 deletions flyway-commandline/src/main/java/org/flywaydb/commandline/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import lombok.SneakyThrows;
import org.flywaydb.commandline.logging.console.ConsoleLog.Level;
import org.flywaydb.commandline.logging.console.ConsoleLogCreator;
Expand Down Expand Up @@ -54,6 +55,7 @@
import org.flywaydb.core.internal.logging.buffered.BufferedLog;
import org.flywaydb.core.internal.logging.multi.MultiLogCreator;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.flywaydb.core.internal.reports.json.CompositeResultDeserializer;
import org.flywaydb.core.internal.util.*;

import java.io.Console;
Expand Down Expand Up @@ -105,8 +107,6 @@ public static void main(String[] args) throws Exception {
}

try {


JavaVersionPrinter.printJavaVersion();
CommandLineArguments commandLineArguments = new CommandLineArguments(pluginRegister, args);
initLogging(commandLineArguments);
Expand Down Expand Up @@ -166,6 +166,8 @@ public static void main(String[] args) throws Exception {
MavenVersionChecker.checkForVersionUpdates();
}

LocalDateTime executionTime = LocalDateTime.now();
CompositeResult<HtmlResult> htmlCompositeResult = new CompositeResult<>();
OperationResult result;
if (commandLineArguments.getOperations().size() == 1) {
String operation = commandLineArguments.getOperations().get(0);
Expand All @@ -178,15 +180,43 @@ public static void main(String[] args) throws Exception {
}
result = compositeResult;
}
Exception aggregate = null;
if (result instanceof CompositeResult<?>) {
CompositeResult<?> compositeResult = (CompositeResult<?>) result;
for(OperationResult individualResult : compositeResult.individualResults) {
if (individualResult instanceof HtmlResult) {
HtmlResult htmlResult = (HtmlResult) individualResult;
htmlCompositeResult.individualResults.add(htmlResult);
if(aggregate == null) {
aggregate = htmlResult.exceptionObject;
} else {
aggregate.addSuppressed(htmlResult.exceptionObject);
}

}
}
} else if (result instanceof HtmlResult) {
HtmlResult htmlResult = (HtmlResult) result;
htmlCompositeResult.individualResults.add(htmlResult);
aggregate = htmlResult.exceptionObject;
}

htmlCompositeResult.individualResults.forEach(r -> r.timestamp = executionTime);

htmlCompositeResult = JsonUtils.appendIfExists(configuration.getReportFilename() + ".json", htmlCompositeResult, new CompositeResultDeserializer(configuration.getPluginRegister()));
String jsonReportFilename = JsonUtils.jsonToFile(configuration.getReportFilename() + ".json", htmlCompositeResult);
String htmlReportFilename = HtmlUtils.toHtmlFile(configuration.getReportFilename() + ".html", htmlCompositeResult, configuration);

if (commandLineArguments.isCommunityFallback()) {
LOG.warn("A Flyway License was not provided; fell back to Community Edition. Please contact sales at sales@flywaydb.org for license information.");
}

if (commandLineArguments.shouldOutputJson()) {
printJson(commandLineArguments, result);
printJson(commandLineArguments, result, jsonReportFilename, htmlReportFilename);
}
if(aggregate != null) {
throw aggregate;
}

} catch (DbMigrate.FlywayMigrateException e) {
MigrateErrorResult errorResult = ErrorOutput.fromMigrateException(e);
printError(commandLineArguments, e, errorResult);
Expand Down Expand Up @@ -274,7 +304,6 @@ private static Configuration getConfiguration(CommandLineArguments commandLineAr




return cfg;
}

Expand Down Expand Up @@ -327,13 +356,12 @@ private static Configuration getLegacyConfiguration(CommandLineArguments command




return new FluentConfiguration(classLoader).configuration(config);
}

private static void printError(CommandLineArguments commandLineArguments, Exception e, OperationResult errorResult) {
if (commandLineArguments.shouldOutputJson()) {
printJson(commandLineArguments, errorResult);
printJson(commandLineArguments, errorResult, null, null);
} else {
if (commandLineArguments.getLogLevel() == Level.DEBUG) {
LOG.error("Unexpected error", e);
Expand Down Expand Up @@ -469,8 +497,8 @@ private static OperationResult executeOperation(Flyway flyway, String operation,



private static void printJson(CommandLineArguments commandLineArguments, OperationResult object) {
String json = convertObjectToJsonString(object);
private static void printJson(CommandLineArguments commandLineArguments, OperationResult object, String jsonReport, String htmlReport) {
String json = convertObjectToJsonString(object, jsonReport, htmlReport);

if (commandLineArguments.isOutputFileSet()) {
Path path = Paths.get(commandLineArguments.getOutputFile());
Expand All @@ -486,14 +514,19 @@ private static void printJson(CommandLineArguments commandLineArguments, Operati
System.out.println(json);
}

private static String convertObjectToJsonString(Object object) {
private static String convertObjectToJsonString(Object object, String jsonReport, String htmlReport) {
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.serializeNulls()
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
.create();
return gson.toJson(object);
JsonElement jsonElements = gson.toJsonTree(object);
if(jsonReport != null) {
jsonElements.getAsJsonObject().addProperty("jsonReport", jsonReport);
jsonElements.getAsJsonObject().addProperty("htmlReport", htmlReport);
}
return gson.toJson(jsonElements);
}

/**
Expand Down
Loading

0 comments on commit 8e3af28

Please sign in to comment.