Merge pull request #44460 from bekoenig

* pr/44460:
  Remove obsolete hints for Flyway Teams features

Closes gh-44460
This commit is contained in:
Moritz Halbritter 2025-02-28 11:19:06 +01:00
commit 278c7a5cdc
3 changed files with 24 additions and 10 deletions

View File

@ -302,7 +302,6 @@ public class FlywayAutoConfiguration {
.to((suffix) -> configuration.scriptPlaceholderSuffix(suffix)); .to((suffix) -> configuration.scriptPlaceholderSuffix(suffix));
configureExecuteInTransaction(configuration, properties, map); configureExecuteInTransaction(configuration, properties, map);
map.from(properties::getLoggers).to((loggers) -> configuration.loggers(loggers)); map.from(properties::getLoggers).to((loggers) -> configuration.loggers(loggers));
// Flyway Teams properties
map.from(properties.getBatch()).to((batch) -> configuration.batch(batch)); map.from(properties.getBatch()).to((batch) -> configuration.batch(batch));
map.from(properties.getDryRunOutput()).to((dryRunOutput) -> configuration.dryRunOutput(dryRunOutput)); map.from(properties.getDryRunOutput()).to((dryRunOutput) -> configuration.dryRunOutput(dryRunOutput));
map.from(properties.getErrorOverrides()) map.from(properties.getErrorOverrides())

View File

@ -275,7 +275,7 @@ public class FlywayProperties {
private String[] loggers = { "slf4j" }; private String[] loggers = { "slf4j" };
/** /**
* Whether to batch SQL statements when executing them. Requires Flyway Teams. * Whether to batch SQL statements when executing them.
*/ */
private Boolean batch; private Boolean batch;
@ -292,12 +292,12 @@ public class FlywayProperties {
private String[] errorOverrides; private String[] errorOverrides;
/** /**
* Whether to stream SQL migrations when executing them. Requires Flyway Teams. * Whether to stream SQL migrations when executing them.
*/ */
private Boolean stream; private Boolean stream;
/** /**
* Properties to pass to the JDBC driver. Requires Flyway Teams. * Properties to pass to the JDBC driver.
*/ */
private Map<String, String> jdbcProperties = new HashMap<>(); private Map<String, String> jdbcProperties = new HashMap<>();
@ -308,25 +308,23 @@ public class FlywayProperties {
/** /**
* Whether Flyway should output a table with the results of queries when executing * Whether Flyway should output a table with the results of queries when executing
* migrations. Requires Flyway Teams. * migrations.
*/ */
private Boolean outputQueryResults; private Boolean outputQueryResults;
/** /**
* Whether Flyway should skip executing the contents of the migrations and only update * Whether Flyway should skip executing the contents of the migrations and only update
* the schema history table. Requires Flyway teams. * the schema history table.
*/ */
private Boolean skipExecutingMigrations; private Boolean skipExecutingMigrations;
/** /**
* Ignore migrations that match this comma-separated list of patterns when validating * List of patterns that identify migrations to ignore when performing validation.
* migrations. Requires Flyway Teams.
*/ */
private List<String> ignoreMigrationPatterns; private List<String> ignoreMigrationPatterns;
/** /**
* Whether to attempt to automatically detect SQL migration file encoding. Requires * Whether to attempt to automatically detect SQL migration file encoding.
* Flyway Teams.
*/ */
private Boolean detectEncoding; private Boolean detectEncoding;

View File

@ -33,6 +33,7 @@ import org.flywaydb.core.api.callback.Context;
import org.flywaydb.core.api.callback.Event; import org.flywaydb.core.api.callback.Event;
import org.flywaydb.core.api.configuration.FluentConfiguration; import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.api.migration.JavaMigration;
import org.flywaydb.core.api.pattern.ValidatePattern;
import org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException; import org.flywaydb.core.internal.license.FlywayEditionUpgradeRequiredException;
import org.flywaydb.database.oracle.OracleConfigurationExtension; import org.flywaydb.database.oracle.OracleConfigurationExtension;
import org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension; import org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension;
@ -915,6 +916,22 @@ class FlywayAutoConfigurationTests {
assertThat(RuntimeHintsPredicates.resource().forResource("db/migration/V1__init.sql")).accepts(runtimeHints); assertThat(RuntimeHintsPredicates.resource().forResource("db/migration/V1__init.sql")).accepts(runtimeHints);
} }
@Test
void detectEncodingCorrectlyMapped() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.flyway.detect-encoding=true")
.run((context) -> assertThat(context.getBean(Flyway.class).getConfiguration().isDetectEncoding())
.isEqualTo(true));
}
@Test
void ignoreMigrationPatternsCorrectlyMapped() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.flyway.ignore-migration-patterns=*:missing")
.run((context) -> assertThat(context.getBean(Flyway.class).getConfiguration().getIgnoreMigrationPatterns())
.containsExactly(ValidatePattern.fromPattern("*:missing")));
}
private ContextConsumer<AssertableApplicationContext> validateFlywayTeamsPropertyOnly(String propertyName) { private ContextConsumer<AssertableApplicationContext> validateFlywayTeamsPropertyOnly(String propertyName) {
return (context) -> { return (context) -> {
assertThat(context).hasFailed(); assertThat(context).hasFailed();