Skip to content

Commit

Permalink
Upgrade to Flyway 10.10
Browse files Browse the repository at this point in the history
Closes gh-40022
  • Loading branch information
wilkinsona committed Mar 19, 2024
1 parent e3f8c34 commit a65e101
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 255 deletions.
2 changes: 2 additions & 0 deletions spring-boot-project/spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ dependencies {
exclude group: "commons-logging", module: "commons-logging"
}
optional("org.flywaydb:flyway-core")
optional("org.flywaydb:flyway-database-postgresql")
optional("org.flywaydb:flyway-database-oracle")
optional("org.flywaydb:flyway-sqlserver")
optional("org.freemarker:freemarker")
Expand Down Expand Up @@ -250,6 +251,7 @@ dependencies {
testImplementation("org.yaml:snakeyaml")

testRuntimeOnly("jakarta.management.j2ee:jakarta.management.j2ee-api")
testRuntimeOnly("org.flywaydb:flyway-database-hsqldb")
testRuntimeOnly("org.jetbrains.kotlin:kotlin-reflect")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,8 +35,8 @@
import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.flywaydb.core.api.migration.JavaMigration;
import org.flywaydb.core.extensibility.ConfigurationExtension;
import org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension;
import org.flywaydb.database.oracle.OracleConfigurationExtension;
import org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension;
import org.flywaydb.database.sqlserver.SQLServerConfigurationExtension;

import org.springframework.aot.hint.RuntimeHints;
Expand Down Expand Up @@ -157,7 +157,7 @@ OracleFlywayConfigurationCustomizer oracleFlywayConfigurationCustomizer() {
}

@Bean
@ConditionalOnClass(name = "org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension")
@ConditionalOnClass(name = "org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension")
PostgresqlFlywayConfigurationCustomizer postgresqlFlywayConfigurationCustomizer() {
return new PostgresqlFlywayConfigurationCustomizer(this.properties);
}
Expand Down Expand Up @@ -305,11 +305,7 @@ private void configureProperties(FluentConfiguration configuration, FlywayProper
map.from(properties.getDryRunOutput()).to((dryRunOutput) -> configuration.dryRunOutput(dryRunOutput));
map.from(properties.getErrorOverrides())
.to((errorOverrides) -> configuration.errorOverrides(errorOverrides));
map.from(properties.getLicenseKey()).to((licenseKey) -> configuration.licenseKey(licenseKey));
map.from(properties.getStream()).to((stream) -> configuration.stream(stream));
map.from(properties.getUndoSqlMigrationPrefix())
.to((undoSqlMigrationPrefix) -> configuration.undoSqlMigrationPrefix(undoSqlMigrationPrefix));
map.from(properties.getCherryPick()).to((cherryPick) -> configuration.cherryPick(cherryPick));
map.from(properties.getJdbcProperties())
.whenNot(Map::isEmpty)
.to((jdbcProperties) -> configuration.jdbcProperties(jdbcProperties));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -291,27 +291,11 @@ public class FlywayProperties {
*/
private String[] errorOverrides;

/**
* Licence key for Flyway Teams.
*/
private String licenseKey;

/**
* Whether to stream SQL migrations when executing them. Requires Flyway Teams.
*/
private Boolean stream;

/**
* File name prefix for undo SQL migrations. Requires Flyway Teams.
*/
private String undoSqlMigrationPrefix;

/**
* Migrations that Flyway should consider when migrating or undoing. When empty all
* available migrations are considered. Requires Flyway Teams.
*/
private String[] cherryPick;

/**
* Properties to pass to the JDBC driver. Requires Flyway Teams.
*/
Expand Down Expand Up @@ -728,14 +712,6 @@ public void setErrorOverrides(String[] errorOverrides) {
this.errorOverrides = errorOverrides;
}

public String getLicenseKey() {
return this.licenseKey;
}

public void setLicenseKey(String licenseKey) {
this.licenseKey = licenseKey;
}

@DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.sqlplus", since = "3.2.0")
@Deprecated(since = "3.2.0", forRemoval = true)
public Boolean getOracleSqlplus() {
Expand Down Expand Up @@ -777,22 +753,6 @@ public void setStream(Boolean stream) {
this.stream = stream;
}

public String getUndoSqlMigrationPrefix() {
return this.undoSqlMigrationPrefix;
}

public void setUndoSqlMigrationPrefix(String undoSqlMigrationPrefix) {
this.undoSqlMigrationPrefix = undoSqlMigrationPrefix;
}

public String[] getCherryPick() {
return this.cherryPick;
}

public void setCherryPick(String[] cherryPick) {
this.cherryPick = cherryPick;
}

public Map<String, String> getJdbcProperties() {
return this.jdbcProperties;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,10 +35,8 @@ class NativeImageResourceProviderCustomizer extends ResourceProviderCustomizer {
@Override
public void customize(FluentConfiguration configuration) {
if (configuration.getResourceProvider() == null) {
Scanner<JavaMigration> scanner = new Scanner<>(JavaMigration.class,
Arrays.asList(configuration.getLocations()), configuration.getClassLoader(),
configuration.getEncoding(), configuration.isDetectEncoding(), false, new ResourceNameCache(),
new LocationScannerCache(), configuration.isFailOnMissingLocations());
Scanner<JavaMigration> scanner = new Scanner<>(JavaMigration.class, false, new ResourceNameCache(),
new LocationScannerCache(), configuration);
NativeImageResourceProvider resourceProvider = new NativeImageResourceProvider(scanner,
configuration.getClassLoader(), Arrays.asList(configuration.getLocations()),
configuration.getEncoding(), configuration.isFailOnMissingLocations());
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a65e101

Please sign in to comment.