Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump flyway.version from 9.17.0 to 9.20.0 #34262

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.1.1</jboss-logmanager.version>
<flyway.version>9.17.0</flyway.version>
<flyway.version>9.20.0</flyway.version>
<yasson.version>3.0.3</yasson.version>
<liquibase.version>4.20.0</liquibase.version>
<snakeyaml.version>2.0</snakeyaml.version>
Expand Down Expand Up @@ -6252,6 +6252,11 @@
<artifactId>flyway-mysql</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-oracle</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
Expand Down
9 changes: 9 additions & 0 deletions docs/src/main/asciidoc/flyway.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ In your build file, add the following dependencies:
* your JDBC driver extension (`quarkus-jdbc-postgresql`, `quarkus-jdbc-h2`, `quarkus-jdbc-mariadb`, ...)
* the MariaDB/MySQL support is now in a separate dependency, MariaDB/MySQL users need to add the `flyway-mysql` dependency from now on.
* the Microsoft SQL Server support is now in a separate dependency, Microsoft SQL Server users need to add the `flyway-sqlserver` dependency from now on.
* the Oracle support is now in a separate dependency, Oracle users need to add the `flyway-database-oracle` dependency from now on.

[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
.pom.xml
Expand All @@ -50,6 +51,12 @@ In your build file, add the following dependencies:
<artifactId>flyway-mysql</artifactId>
</dependency>

<!-- Flyway Oracle specific dependencies -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-oracle</artifactId>
</dependency>

<!-- JDBC driver dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -66,6 +73,8 @@ implementation("io.quarkus:quarkus-flyway")
implementation("org.flywaydb:flyway-sqlserver")
// Flyway MariaDB/MySQL specific dependencies
implementation("org.flywaydb:flyway-mysql")
// Flyway Oracle specific dependencies
implementation("org.flywaydb:flyway-database-oracle")
// JDBC driver dependencies
implementation("io.quarkus:quarkus-jdbc-postgresql")
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public Flyway createFlyway(DataSource dataSource) {

configure.dataSource(jdbcUrl, flywayRuntimeConfig.username.get(),
flywayRuntimeConfig.password.get());
} else {

} else if (dataSource != null) {
configure.dataSource(dataSource);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package io.quarkus.flyway.runtime.graal;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.flywaydb.core.extensibility.ConfigurationExtension;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.flywaydb.core.internal.util.MergeUtils;

import com.google.gson.Gson;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(className = "org.flywaydb.core.api.configuration.ClassicConfiguration")
public final class ClassicConfigurationSubstitutions {

@Alias
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias)
private static Pattern ANY_WORD_BETWEEN_TWO_QUOTES_PATTERN = Pattern.compile("\"([^\"]*)\"");

@Alias
PluginRegister pluginRegister;

@Substitute
private void determineKeysToRemoveAndRemoveFromProps(HashMap<String, Map<String, Object>> configExtensionsPropertyMap,
List<String> keysToRemove, Map<String, String> props) {
for (Map.Entry<String, Map<String, Object>> property : configExtensionsPropertyMap.entrySet()) {
ConfigurationExtension cfg = null;
for (ConfigurationExtension c : pluginRegister.getPlugins(ConfigurationExtension.class)) {
if (c.getClass().toString().equals(property.getKey())) {
cfg = c;
break;
}
}
if (cfg != null) {
Map<String, Object> mp = property.getValue();
try {
Gson gson = new Gson();
ConfigurationExtension newConfigurationExtension = gson.fromJson(gson.toJson(mp), cfg.getClass());
MergeUtils.mergeModel(newConfigurationExtension, cfg);
} catch (Exception e) {
Matcher matcher = ANY_WORD_BETWEEN_TWO_QUOTES_PATTERN.matcher(e.getMessage());
if (matcher.find()) {
String errorProperty = matcher.group(1);
List<String> propsToRemove = new ArrayList<>();
for (String k : keysToRemove) {
if (k.endsWith(errorProperty)) {
propsToRemove.add(k);
}
}
keysToRemove.removeAll(propsToRemove);
}
}
}
}

props.keySet().removeAll(keysToRemove);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.function.BooleanSupplier;

import org.flywaydb.core.api.configuration.Configuration;
import org.flywaydb.core.internal.database.oracle.OracleDatabaseType;
import org.flywaydb.core.internal.util.ClassUtils;

import com.oracle.svm.core.annotate.Substitute;
Expand All @@ -13,7 +12,9 @@
/**
* Avoid loading the oracle.jdbc.OracleConnection class if unavailable
*/
@TargetClass(value = OracleDatabaseType.class, onlyWith = OracleDatabaseTypeSubstitution.OracleDriverUnavailable.class)
@TargetClass(className = "org.flywaydb.database.oracle.OracleDatabaseType", onlyWith = {
OracleDatabaseTypeSubstitution.OracleAvailable.class,
OracleDatabaseTypeSubstitution.OracleDriverUnavailable.class })
public final class OracleDatabaseTypeSubstitution {

@Substitute
Expand All @@ -27,4 +28,12 @@ public boolean getAsBoolean() {
return !ClassUtils.isPresent("oracle.jdbc.OracleConnection", Thread.currentThread().getContextClassLoader());
}
}

public static final class OracleAvailable implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return ClassUtils.isPresent("org.flywaydb.database.oracle.OracleDatabaseType",
Thread.currentThread().getContextClassLoader());
}
}
}