Skip to content

Commit

Permalink
Bump version to flyway-10.8.0
Browse files Browse the repository at this point in the history
Please see the GH release for the release notes

add db-specific info to oracle parsing errors

Upgrade com.nimbusds:nimbus-jose-jwt@9.37.2 to fix CVE-2023-52428

Downgrade MariaDB Connect/J to 2.7.11
  • Loading branch information
rg-buildmonkey committed Feb 15, 2024
1 parent bf907e6 commit f5336ea
Show file tree
Hide file tree
Showing 59 changed files with 329 additions and 119 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
#
# Copyright (C) Red Gate Software Ltd 2010-2024
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Build PRs

on:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
#
# Copyright (C) Red Gate Software Ltd 2010-2024
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Build Release Tags

on:
Expand Down
28 changes: 14 additions & 14 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# Copyright (C) Red Gate Software Ltd 2010-2024
# https://www.apache.org/licenses/LICENSE-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
12 changes: 12 additions & 0 deletions documentation/Flyway CLI and API/Concepts/Migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ have been executed. Repeatable migrations are applied in the order of their desc
By default both versioned and repeatable migrations can be written either in **[SQL](Concepts/migrations#sql-based-migrations)**
or in **[Java](Concepts/migrations#java-based-migrations)** and can consist of multiple statements.

A short summary:

| Migration Type | Category | Example
|----------------|------------------| -----------------------------------------------------
| SQL | Versioned | V2__Add_new_table.sql
| SQL | Versioned (Undo) | U2__Add_new_table.sql
| SQL | Repeatable | R__Add_new_table.sql
| Java | Versioned | V2__Add_new_table.java
| Java | Repeatable | R__Add_new_table.java
| Script | Versioned | V1__execute_batch_tool.ps1
| Script | Repeatable | R__execute_batch_tool.ps1

Flyway automatically discovers migrations on the *filesystem* and on the Java *classpath*.

To keep track of which migrations have already been applied when and by whom, Flyway adds a *schema history table*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
subtitle: placeholder page
---
<div id="children">
{% include childPages.html %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
subtitle: placeholder page
---
<div id="children">
{% include childPages.html %}
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
subtitle: Contributing Database Compatibility
---
# Community database support
Flyway is an open source project and so database compatibility can be contributed by the open source community.
Redgate will review submissions but the capabilities of the driver are dependent on the requirements of the originator.

# Contributing Database Compatibility to Flyway

Flyway follows an Open Source model for the Community edition. We welcome code contributions through Pull Requests on the [Flyway Community DB Support GitHub page](https://github.com/flyway/flyway-community-db-support). This article will provide help with contributing code to make Flyway compatible with a new database platform.
Expand All @@ -22,7 +26,7 @@ You should be able to open the project and see a number of modules.
1. Create a new folder `foo` in `org.flywaydb.community.database` to contain your new classes.
1. In the folder create classes `FooDatabase` (subclassed from Database), `FooSchema` (subclassed from Schema), and `FooTable` (subclassed from Table). These classes make up Flyway's internal representation of the parts of your database that it works on.
1. Create class `FooParser` (subclassed from Parser). This represents a simplified version of a parser for your database's dialect of SQL. When finished it will be able to decompose a migration script into separate statements and report on serious errors, but it does not need to fully understand them.
1. Create a class `FooDatabaseType` subclassed from `DatabaseType` in the folder your created. This class acts as the collation class that brings together all the classes you created before. Implement the required methods. There are also some optional methods you can override to customize the behavior.
1. Create a class `FooDatabaseType` subclassed from `CommunityDatabaseType` in the folder your created. This class acts as the collation class that brings together all the classes you created before. Implement the required methods. There are also some optional methods you can override to customize the behavior.
* `createSqlScriptFactory` - To use a custom SqlScriptFactory
* `createSqlScriptExecutorFactory` - To use a custom SqlScriptExecutorFactory
* `createExecutionStrategy` - To use a custom DatabaseExecutionStrategy
Expand Down Expand Up @@ -76,7 +80,7 @@ You should be able to open the project and see a number of modules.
* `doExists()` - to query whether the table described exists in the database
* `doLock()` - to lock the table with a read/write pessimistic lock until the end of the current transaction. This is used to prevent concurrent reads and writes to the schema history while a migration is underway. If your database doesn't support table-level locks, do nothing.

1. Finally, expose your database support to the Flyway engine by adding the full qualified name of your `DatabaseType` class to `<your module>/src/main/resources/META-INF/services/org.flywaydb.core.extensibility.Plugin`
1. Finally, expose your database support to the Flyway engine by adding the full qualified name of your `CommunityDatabaseType` class to `<your module>/src/main/resources/META-INF/services/org.flywaydb.core.extensibility.Plugin`

### How to test your plugin
#### Testing with a prebuilt Flyway CLI package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ dependencies {
## SQL Script Syntax

- Standard SQL statements ending with the semicolon (`;`) delimiter are handled as normal.
- PL/SQL blocks and SQL*Plus statements must be delimited by `/` on a new line.
- PL/SQL blocks and SQL*Plus statements must be delimited by `/` on a new line. PL/SQL includes:
- Types
- Packages
- Functions
- Procedures
- Views with functions/procedures
- Triggers
- Java sources

### Compatibility

Expand Down
12 changes: 10 additions & 2 deletions documentation/Flyway CLI and API/Usage/Code Analysis Rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ You can find more detail of these rules in the [SQLFluff rules](https://docs.sql
Redgate has added a set of additional rules that are of interest to customers with a larger and more complex database infrastructure.

Enterprise customers are also able to define their own rules - see [Creating Regular Expression Rules](Learn More/Creating Regular Expression Rules)
## Flyway_L001
## Flyway_L001 ( **[DEPRECATED]**, replaced by RX013)
_CREATE TABLE statement without a PRIMARY KEY constraint_

**Dialects:** All

It is best practice in most situations to define a primary key for each table. This can facilitate querying and ordering data
## Flyway_L002
## Flyway_L002 ( **[DEPRECATED]**, replaced by RX014)
_A table has been created but has no MS_Description property added_

**Dialects:** TSQL
Expand Down Expand Up @@ -98,5 +98,13 @@ This is used to modify user accounts so should be investigated before continuing
_DROP PARTITION statement used_

**Dialects:** All
## RX013
_CREATE TABLE statement without a PRIMARY KEY constraint_

**Dialects:** All
## RX014
_A table has been created but has no MS_Description property added_

**Dialects:** TSQL

This operation is likely to result in a loss of data so should be investigated before continuing
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@
</div>
<div class="col-md-9">

<div class="release">
<h2 id="10.8.0">Flyway 10.8.0 (2024-02-15)</h2>

<h3>Changes</h3>
<ul>
<li>output from flyway info can return the contents of a shouldExecute condition, if provided</li>
<li>
<a href="https://github.com/flyway/flyway/issues/3835">Issue 3835</a>
Downgrade MariaDB Connect/J from 3.3.2 to 2.7.11 to continue to support latest MariaDB without compatibility issues with MySQL. MariaDB 3.X Connect/J requires for `permitMysqlScheme` flag in the URL
</li>
</ul>

<h3>New features</h3>
<ul>
<li>Provide Regex rules to replace the SQLFluff rules Flyway_L001 and Flyway_L002</li>
</ul>

<h3>Java compatibility</h3>
<ul>
<li>Upgrade com.nimbusds:nimbus-jose-jwt@9.37.2 to fix CVE-2023-52428</li>
</ul>

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

<div class="release">
<h2 id="10.7.2">Flyway 10.7.2 (2024-02-08)</h2>

Expand Down Expand Up @@ -61,6 +88,7 @@ <h2 id="10.7.1">Flyway 10.7.1 (2024-01-30)</h2>
<h3>Breaking changes</h3>
<ul>
<li>The Flyway Commandline package no longer includes dependencies for Apache Derby. This is due to CVE-2022-46337. Apache have not released Java-17 compatible jars with the vulnerability fixed, so users will have to acquire their own Derby dependencies. See <a href="https://documentation.red-gate.com/flyway/flyway-cli-and-api/supported-databases/derby">Flyway Derby database support</a> for details</li>
<li>Due to a change in the latest version of the MariaDB driver, MySQL users will either have to set 'permitMysqlScheme=true' in their connection string or download the MySQL driver. See <a href="https://documentation.red-gate.com/flyway/flyway-cli-and-api/supported-databases/mysql">here</a> for more details.</li>
</ul>

<h3>Bug fixes</h3>
Expand Down Expand Up @@ -324,7 +352,7 @@ <h3>New features</h3>
<h3>Java compatibility</h3>
<ul>
<li>Deprecated Java 8. Java 17 is now required for development</li>
<li>Move packages & groupID from `org.flywaydb.enterprise` to `com.redgate.flyway`. Duplicate packages will be deployed to `org.flywaydb.enterprise` until a future release.</li>
<li>Move packages and groupID from `org.flywaydb.enterprise` to `com.redgate.flyway`. Duplicate packages will be deployed to `org.flywaydb.enterprise` until a future release.</li>
</ul>

<h3>Notes</h3>
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: 10.7.2
flywayVersion: 10.8.0
enterpriseUrl: https://download.red-gate.com/maven/release/com/redgate/flyway
kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
Expand Down
8 changes: 7 additions & 1 deletion 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>10.7.2</version>
<version>10.8.0</version>
</parent>
<artifactId>flyway-commandline</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -159,6 +159,12 @@
<version>10.7.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-oceanbase</artifactId>
<version>10.7.2</version>
<scope>runtime</scope>
</dependency>



Expand Down
3 changes: 3 additions & 0 deletions flyway-commandline/src/main/assembly/component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
<include>org.flywaydb:flyway-database-tidb</include>
<include>org.flywaydb:flyway-database-yugabytedb</include>
<include>org.flywaydb:flyway-database-clickhouse</include>
<include>org.flywaydb:flyway-database-oceanbase</include>
</includes>
</dependencySet>
<dependencySet>
Expand All @@ -258,6 +259,8 @@
</includes>
<excludes>
<exclude>org.flywaydb:flyway-*</exclude>
<exclude>org.flywaydb.enterprise:flyway-*</exclude>
<exclude>com.redgate.flyway:flyway-*</exclude>
<exclude>org.fusesource.jansi:jansi</exclude>
<exclude>com.google.code.gson:gson</exclude>
<exclude>software.amazon.awssdk:s3</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static RootTelemetryModel populateRootTelemetry(RootTelemetryModel rootTe
rootTelemetryModel.setTrial(LicenseGuard.getPermit(configuration).isTrial());
ConfigurationModel modernConfig = configuration.getModernConfig();
if (modernConfig != null && StringUtils.hasText(modernConfig.getId())) {
rootTelemetryModel.setProjectId(EncryptionUtils.hashProjectId(modernConfig.getId(), "fur"));
rootTelemetryModel.setProjectId(EncryptionUtils.hashString(modernConfig.getId(), "fur"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion flyway-core/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>10.7.2</version>
<version>10.8.0</version>
</parent>
<artifactId>flyway-core</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.flywaydb.core.internal.clazz.NoopClassProvider;
import org.flywaydb.core.internal.configuration.ConfigurationValidator;
import org.flywaydb.core.internal.database.DatabaseType;
import org.flywaydb.core.internal.database.base.CommunityDatabaseType;
import org.flywaydb.core.internal.database.base.Database;
import org.flywaydb.core.internal.database.base.Schema;
import org.flywaydb.core.internal.jdbc.JdbcConnectionFactory;
Expand Down Expand Up @@ -159,6 +160,10 @@ public <T> T execute(Command<T> command, boolean scannerRequired, FlywayTelemetr
if (!dbConnectionInfoPrinted) {
dbConnectionInfoPrinted = true;

if (database.getDatabaseType() instanceof CommunityDatabaseType) {
LOG.info(((CommunityDatabaseType) database.getDatabaseType()).announcementForCommunitySupport());
}

LOG.info("Database: " + redactJdbcUrl(jdbcConnectionFactory.getJdbcUrl()) + " (" + jdbcConnectionFactory.getProductName() + ")");
LOG.debug("Driver: " + jdbcConnectionFactory.getDriverInfo());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,7 @@ public FlywayTelemetryManager(PluginRegister pluginRegister){

String userId = System.getenv("RG_TELEMETRY_ANONYMOUS_USER_ID");
if(!userId.hasText()) {
boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win");
File redgateAppData;
if (isWindows) {
redgateAppData = new File(System.getenv("APPDATA"), "Redgate");
} else {
redgateAppData = new File(System.getProperty("user.home"), ".config/Redgate");
}
File userIdFile = new File(redgateAppData, "feature_usage_data");
if (userIdFile.exists()) {
userId = FileUtils.readAsString(userIdFile.toPath());
}
if(!userId.hasText()) {
userId = UUID.randomUUID().toString();
if(!redgateAppData.exists()) {
redgateAppData.mkdirs();
}
try(FileWriter fileWriter = new FileWriter(userIdFile)) {
fileWriter.write(userId);
} catch (IOException ignore) {}
}
userId = FileUtils.readUserIdFromFileIfNoneWriteDefault();
}

rootTelemetryModel.setUserId(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ default boolean isVersioned() {
* @return The result between a comparison of these MigrationInfo's versions.
*/
int compareVersion(MigrationInfo o);

/**
* @return The shouldExecute expression if present and supported by the migration type. Otherwise {@code null}.
*/
default String getShouldExecuteExpression() { return null; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ public interface MigrationExecutor {
* @return {@code true} if the migration should be executed, or {@code false} if not.
*/
boolean shouldExecute();

/**
* Optionally, an executor may provide an expression string describing the conditions under which {@code shouldExecute}
* may return {@code true}. The {@code shouldExecute} function itself is the source of truth for whether a script
* may execute, this function is provided for providing additional information rather than direct evaluation.
*
* @return A string expression for the shouldExecute function, or {@code null}
*/
default String shouldExecuteExpression() { return null; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static InfoOutput createInfoOutput(Set<MigrationInfo> undoableMigrations,
migrationInfo.getPhysicalLocation() != null ? migrationInfo.getPhysicalLocation() : "",
getUndoablePath(migrationInfo, undoableMigrations),
migrationInfo.getInstalledBy() != null ? migrationInfo.getInstalledBy() : "",
migrationInfo.getShouldExecuteExpression(),
migrationInfo.getExecutionTime() != null ? migrationInfo.getExecutionTime() : 0);
}

Expand Down
Loading

0 comments on commit f5336ea

Please sign in to comment.