Skip to content

Commit

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

add connection attributes for singlestore

Use instance defaultProperties in DriverDataSource
  • Loading branch information
rg-buildmonkey committed Dec 20, 2023
1 parent 5ca414d commit e60bf2b
Show file tree
Hide file tree
Showing 39 changed files with 132 additions and 753 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ When using the CLI, you can add to the classpath by dropping the `.jar` files fo
<i class="fa fa-file-text"></i> README.txt
</pre>

You can also specify more folders to load jars from using the [jarDirs](Configuration/Parameters/Flyway/Jar Dirs.md) configuration parameter.
You can also specify more folders to load jars from using the [jarDirs](/Configuration/Parameters/Flyway/Jar Dirs) configuration parameter.

### API

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ table = flyway_schema_history</pre>

<p>Yes! Flyway can replace placeholders in Sql migrations. The default pattern is ${placeholder}. This can be
configured using the placeholderPrefix and placeholderSuffix properties.<br/> <br/>
See <a href="../Configuration/Flyway/Placeholders">Placeholders</a> for more details.</p>
See <a href="../flyway-cli-and-api/Configuration/parameters/Flyway/Placeholders">Placeholders</a> for more details.</p>

<h2 id="spring">Does Flyway depend on Spring?</h2>

Expand Down
2 changes: 1 addition & 1 deletion documentation/Flyway CLI and API/Learn More/Roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ redirect_from: /documentation/roadmap/

<p>Flyway Community is suitable for non-commercial projects and organisations. The general priority is bug fixes and documentation improvements, followed by new features.</p>

<p>For more details, check out the <a href="https://github.com/flyway/flyway/milestones">milestone plan on GitHub</a>.
<p>For more details, check out the <a href="https://github.com/flyway/flyway/milestones">milestone plan on GitHub</a>.</p>

<h2>Flyway Teams and Enterprise editions</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ Now that you are using the Teams / Enterprise edition of Flyway, you can take ad
- Optimise the execution of migrations using [batching](Configuration/parameters/flyway/batch) or [streaming](Configuration/parameters/flyway/stream).
- Gain more control over your deployments by [cherry picking](Configuration/Parameters/Flyway/Cherry Pick) which migrations to execute.
- Apply migrations manually outside of Flyway but update the schema history using [mark as applied](Configuration/Parameters/Flyway/Skip Executing Migrations).
- [Guaranteed support for databases](/https://flywaydb.org/download/faq#how-long-are-database-releases-supported-in-each-edition-of-flyway) up to 10 years old.
- Leverage the power of [Oracle SQL*Plus](Supported Databases/oracle database#sqlplus-commands) in your migrations.
- Promote database warnings to errors, or ignore errors thrown during execution with [error overrides](Concepts/Error Overrides).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ You might want this to:
## Learn more
* [Check concept](Concepts/Check Concept) - how does it work ?
* [Check command](Commands/Check) - What is the command structure ?
* [Tutorial - Using Flyway Check](Tutorials/Tutorial - Using Flyway Check with SQL Server.md) - how do I use it ?
* [Tutorial - Using Flyway Check](Tutorials/Tutorial - Using Flyway Check with SQL Server) - how do I use it ?
* Get a [Flyway Enterprise Trial here](https://www.red-gate.com/products/flyway/enterprise/trial/) or start a trial with the [auth](Commands/Auth) command.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
</div>
<div class="col-md-9">

<div class="release">
<h2 id="10.4.0">Flyway 10.4.0 (2023-12-20)</h2>

<h3>Bug fixes</h3>
<ul>
<li>Use instance variable of defaultProperties in DriverDataSource constructor instead of parameter variable</li>
</ul>

</div>

<div class="release">
<h2 id="10.3.0">Flyway 10.3.0 (2023-12-14)</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: 10.3.0
flywayVersion: 10.4.0
enterpriseUrl: https://download.red-gate.com/maven/release/com/redgate/flyway
kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
Expand Down
2 changes: 1 addition & 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.3.0</version>
<version>10.4.0</version>
</parent>
<artifactId>flyway-commandline</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 2 additions & 0 deletions flyway-commandline/src/main/assembly/component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
<include>com.nimbusds:nimbus-jose-jwt</include>
<include>com.nimbusds:oauth2-oidc-sdk</include>
<include>org.eclipse.jetty:jetty-server</include>
<include>net.java.dev.jna:jna</include>
<include>com.microsoft.azure:msal4j-persistence-extension</include>
</includes>
</dependencySet>
<dependencySet>
Expand Down
2 changes: 1 addition & 1 deletion flyway-community-db-support/flyway-database-ignite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-community-db-support</artifactId>
<version>10.3.0</version>
<version>10.4.0</version>
</parent>

<artifactId>flyway-database-ignite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flyway-community-db-support/flyway-database-tidb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-community-db-support</artifactId>
<version>10.3.0</version>
<version>10.4.0</version>
</parent>

<artifactId>flyway-database-tidb</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-community-db-support</artifactId>
<version>10.3.0</version>
<version>10.4.0</version>
</parent>

<artifactId>flyway-database-yugabytedb</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flyway-community-db-support/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.3.0</version>
<version>10.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

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.3.0</version>
<version>10.4.0</version>
</parent>
<artifactId>flyway-core</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
@SuppressWarnings("unused")
public interface EnvironmentProvisioner extends Plugin {
String getName();
default Class getConfigClass() {
return null;

default Class<?> getConfigClass() {
return null;
}
default void setConfiguration(ConfigurationExtension config) { }
default void preProvision(PropertyResolverContext context, ProgressLogger progress) { }
default void preReprovision(PropertyResolverContext context, ProgressLogger progress) { }
default void postProvision(PropertyResolverContext context, ResolvedEnvironment resolvedEnvironment, ProgressLogger progress) { }
default void postReprovision(PropertyResolverContext context, ResolvedEnvironment resolvedEnvironment, ProgressLogger progress) { }

default void setConfiguration(final ConfigurationExtension config) { }

default void preProvision(final PropertyResolverContext context, final ProgressLogger progress) { }

default void preReprovision(final PropertyResolverContext context, final ProgressLogger progress) { }

default void postProvision(final PropertyResolverContext context, final ResolvedEnvironment resolvedEnvironment, final ProgressLogger progress) { }

default void postReprovision(final PropertyResolverContext context, final ResolvedEnvironment resolvedEnvironment, final ProgressLogger progress) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,43 @@
package org.flywaydb.core.internal.configuration.resolvers;

import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.flywaydb.core.ProgressLogger;
import org.flywaydb.core.api.ErrorCode;
import org.flywaydb.core.api.FlywayException;

import org.flywaydb.core.api.configuration.Configuration;
import org.flywaydb.core.extensibility.ConfigurationExtension;
import org.flywaydb.core.internal.configuration.models.ConfigurationModel;
import org.flywaydb.core.extensibility.Plugin;

import org.flywaydb.core.api.configuration.Configuration;

import org.flywaydb.core.internal.configuration.models.EnvironmentModel;
import org.flywaydb.core.internal.configuration.models.ResolvedEnvironment;

import java.util.HashMap;
import java.util.Map;
import org.flywaydb.core.internal.plugin.PluginRegister;

public class EnvironmentResolver {

private final Map<String, PropertyResolver> propertyResolvers;
private final Map<String, EnvironmentProvisioner> environmentProvisioners;
private final Map<String, ? extends EnvironmentProvisioner> environmentProvisioners;

public EnvironmentResolver(Map<String, PropertyResolver> propertyResolvers,
Map<String, EnvironmentProvisioner> environmentProvisioners) {
this.propertyResolvers = propertyResolvers;
this.environmentProvisioners = environmentProvisioners;
public EnvironmentResolver(final Map<String, PropertyResolver> propertyResolvers,
final Map<String, ? extends EnvironmentProvisioner> environmentProvisioners) {
this.propertyResolvers = new HashMap<>(propertyResolvers);
this.environmentProvisioners = new HashMap<>(environmentProvisioners);
}

public ResolvedEnvironment resolve(String environmentName, EnvironmentModel environment,
Configuration configuration, ProgressLogger progress) {
public ResolvedEnvironment resolve(final String environmentName, final EnvironmentModel environment,
final Configuration configuration, final ProgressLogger progress) {
return resolve(environmentName, environment, ProvisionerMode.Provision, configuration, progress);
}

public ResolvedEnvironment resolve(String environmentName, EnvironmentModel environment, ProvisionerMode mode,
Configuration configuration, ProgressLogger progress) {
Map<String, ConfigurationExtension> resolverConfigs = getEnvironmentPluginConfigMap(environment,
public ResolvedEnvironment resolve(final String environmentName, final EnvironmentModel environment, final ProvisionerMode mode,
final Configuration configuration, final ProgressLogger progress) {
final Map<String, ConfigurationExtension> resolverConfigs = getEnvironmentPluginConfigMap(environment,
configuration.getPluginRegister());
PropertyResolverContext context = new PropertyResolverContextImpl(environmentName, configuration,
final PropertyResolverContext context = new PropertyResolverContextImpl(environmentName, configuration,
propertyResolvers, resolverConfigs);

ResolvedEnvironment result = new ResolvedEnvironment();
final ResolvedEnvironment result = new ResolvedEnvironment();
result.setDriver(environment.getDriver());
result.setConnectRetries(environment.getConnectRetries());
result.setConnectRetriesInterval(environment.getConnectRetriesInterval());
Expand All @@ -67,10 +61,10 @@ public ResolvedEnvironment resolve(String environmentName, EnvironmentModel envi
result.setJarDirs(environment.getJarDirs());

progress.pushSteps(2);
ProgressLogger provisionProgress = progress.subTask("provision");
ProgressLogger resolveProgress = progress.subTask("resolve");
final ProgressLogger provisionProgress = progress.subTask("provision");
final ProgressLogger resolveProgress = progress.subTask("resolve");

EnvironmentProvisioner provisioner = getProvisioner(environment.getProvisioner(), context, provisionProgress);
final EnvironmentProvisioner provisioner = getProvisioner(environment.getProvisioner(), context, provisionProgress);
if (mode == ProvisionerMode.Provision) {
progress.log("Provisioning environment " + environmentName + " with " + provisioner.getName());
provisioner.preProvision(context, provisionProgress);
Expand All @@ -81,8 +75,8 @@ public ResolvedEnvironment resolve(String environmentName, EnvironmentModel envi

progress.log("Resolving environment properties " + environmentName);
if (environment.getJdbcProperties() != null) {
Map<String, String> jdbcResolvedProps = new HashMap<>();
for (Map.Entry<String, String> entry : environment.getJdbcProperties().entrySet()) {
final Map<String, String> jdbcResolvedProps = new HashMap<>();
for (final Map.Entry<String, String> entry : environment.getJdbcProperties().entrySet()) {
jdbcResolvedProps.put(entry.getKey(), context.resolveValue(entry.getValue(), resolveProgress));
}
result.setJdbcProperties(jdbcResolvedProps);
Expand All @@ -104,9 +98,9 @@ public ResolvedEnvironment resolve(String environmentName, EnvironmentModel envi
return result;
}

private EnvironmentProvisioner getProvisioner(String provisionerName, PropertyResolverContext context,
ProgressLogger progress) {
String name = context.resolveValue(provisionerName, progress);
private EnvironmentProvisioner getProvisioner(final String provisionerName, final PropertyResolverContext context,
final ProgressLogger progress) {
final String name = context.resolveValue(provisionerName, progress);
if (name != null) {
if (!environmentProvisioners.containsKey(provisionerName)) {
throw new FlywayException(
Expand All @@ -118,33 +112,37 @@ private EnvironmentProvisioner getProvisioner(String provisionerName, PropertyRe
return new EnvironmentProvisionerNone();
}

private Map<String, ConfigurationExtension> getEnvironmentPluginConfigMap(EnvironmentModel environmentModel,
PluginRegister pluginRegister) {
private Map<String, ConfigurationExtension> getEnvironmentPluginConfigMap(final EnvironmentModel environmentModel,
final PluginRegister pluginRegister) {

if (environmentModel.getResolvers() != null) {

return environmentModel.getResolvers()
.keySet()
.stream()
.collect(Collectors.toMap(k->k, v->getResolverConfig(environmentModel, pluginRegister, v)));
.collect(Collectors.toMap(key->key, v->getResolverConfig(environmentModel, pluginRegister, v)));
}
return null;
}


private ConfigurationExtension getResolverConfig(EnvironmentModel environmentModel, PluginRegister pluginRegister,
String key) {
Class clazz = getResolverConfigClassFromKey(pluginRegister, key);
private ConfigurationExtension getResolverConfig(final EnvironmentModel environmentModel, final PluginRegister pluginRegister,
final String key) {
final Class<?> clazz = getResolverConfigClassFromKey(pluginRegister, key);

if (clazz != null) {
var data = environmentModel.getResolvers().get(key);
return (ConfigurationExtension) new ObjectMapper().convertValue(data, clazz);
try {
final var data = environmentModel.getResolvers().get(key);
return (ConfigurationExtension) new ObjectMapper().convertValue(data, clazz);
} catch (final IllegalArgumentException e) {
throw new FlywayException("Error reading resolver configuration for resolver " + key, e, ErrorCode.CONFIGURATION);
}
}

throw new FlywayException("Unable to find resolver: " + key);
}

private Class getResolverClassFromKey(PluginRegister pluginRegister, String key) {
private Class<? extends Plugin> getResolverClassFromKey(final PluginRegister pluginRegister, final String key) {
Plugin plugin = pluginRegister.getPlugins(EnvironmentProvisioner.class).stream()
.filter(p -> p.getName().equalsIgnoreCase(key))
.findFirst()
Expand All @@ -165,17 +163,17 @@ private Class getResolverClassFromKey(PluginRegister pluginRegister, String key)
throw new FlywayException("Unable to find resolver: " + key);
}

private Class getResolverConfigClassFromKey(PluginRegister pluginRegister, String key) {
Class resolverClass = getResolverClassFromKey(pluginRegister, key);
private Class<?> getResolverConfigClassFromKey(final PluginRegister pluginRegister, final String key) {
final Class<? extends Plugin> resolverClass = getResolverClassFromKey(pluginRegister, key);
if (resolverClass == null) {
return null;
}

Plugin plugin = pluginRegister.getPlugin(resolverClass);
if (plugin instanceof EnvironmentProvisioner environmentProvisioner){
final Plugin plugin = pluginRegister.getPlugin(resolverClass);
if (plugin instanceof final EnvironmentProvisioner environmentProvisioner){
return environmentProvisioner.getConfigClass();
}
if (plugin instanceof PropertyResolver propertyResolver){
if (plugin instanceof final PropertyResolver propertyResolver){
return propertyResolver.getConfigClass();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public DriverDataSource(ClassLoader classLoader, String driverClass, String url,
this.additionalProperties = new HashMap<>();
}
this.defaultProperties = new Properties(defaultProperties);
type.setDefaultConnectionProps(url, defaultProperties, classLoader);
type.setConfigConnectionProps(configuration, defaultProperties, classLoader);
type.setDefaultConnectionProps(url, this.defaultProperties, classLoader);
type.setConfigConnectionProps(configuration, this.defaultProperties, classLoader);
type.setOverridingConnectionProps(this.additionalProperties);

try {
Expand Down Expand Up @@ -154,7 +154,7 @@ public DriverDataSource(ClassLoader classLoader, String driverClass, String url,
this.password = detectFallbackPassword(password);

if (type.externalAuthPropertiesRequired(url, user, password)) {
defaultProperties.putAll(type.getExternalAuthProperties(url, user));
this.defaultProperties.putAll(type.getExternalAuthProperties(url, user));
}
}

Expand Down
2 changes: 1 addition & 1 deletion flyway-database/flyway-database-db2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-parent</artifactId>
<version>10.3.0</version>
<version>10.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit e60bf2b

Please sign in to comment.