@@ -161,106 +161,117 @@ private void applyCommonBuilderProperties(FlywayProperties properties, DataSourc
161
161
}
162
162
}
163
163
164
+ /**
165
+ * Configure the given {@code configuration} using the given {@code properties}.
166
+ * <p>
167
+ * To maximize forwards- and backwards-compatibility method references are not
168
+ * used.
169
+ * @param configuration the configuration
170
+ * @param properties the properties
171
+ */
164
172
private void configureProperties (FluentConfiguration configuration , FlywayProperties properties ) {
165
173
PropertyMapper map = PropertyMapper .get ().alwaysApplyingWhenNonNull ();
174
+ configureFailOnMissingLocations (configuration , properties .isFailOnMissingLocations ());
166
175
String [] locations = new LocationResolver (configuration .getDataSource ())
167
176
.resolveLocations (properties .getLocations ())
168
177
.toArray (new String [0 ]);
169
- configureFailOnMissingLocations (configuration , properties .isFailOnMissingLocations ());
170
- map .from (locations ).to (configuration ::locations );
171
- map .from (properties .getEncoding ()).to (configuration ::encoding );
172
- map .from (properties .getConnectRetries ()).to (configuration ::connectRetries );
173
- // No method reference for compatibility with Flyway < 7.15
178
+ configuration .locations (locations );
179
+ map .from (properties .getEncoding ()).to ((encoding ) -> configuration .encoding (encoding ));
180
+ map .from (properties .getConnectRetries ())
181
+ .to ((connectRetries ) -> configuration .connectRetries (connectRetries ));
174
182
map .from (properties .getConnectRetriesInterval ())
175
183
.to ((interval ) -> configuration .connectRetriesInterval ((int ) interval .getSeconds ()));
176
- // No method reference for compatibility with Flyway 6.x
177
184
map .from (properties .getLockRetryCount ())
178
185
.to ((lockRetryCount ) -> configuration .lockRetryCount (lockRetryCount ));
179
- // No method reference for compatibility with Flyway 5.x
180
186
map .from (properties .getDefaultSchema ()).to ((schema ) -> configuration .defaultSchema (schema ));
181
- map .from (properties .getSchemas ()).as (StringUtils ::toStringArray ).to (configuration ::schemas );
187
+ map .from (properties .getSchemas ())
188
+ .as (StringUtils ::toStringArray )
189
+ .to ((schemas ) -> configuration .schemas (schemas ));
182
190
configureCreateSchemas (configuration , properties .isCreateSchemas ());
183
- map .from (properties .getTable ()).to (configuration ::table );
184
- // No method reference for compatibility with Flyway 5.x
191
+ map .from (properties .getTable ()).to ((table ) -> configuration .table (table ));
185
192
map .from (properties .getTablespace ()).to ((tablespace ) -> configuration .tablespace (tablespace ));
186
- map .from (properties .getBaselineDescription ()).to (configuration ::baselineDescription );
187
- map .from (properties .getBaselineVersion ()).to (configuration ::baselineVersion );
188
- map .from (properties .getInstalledBy ()).to (configuration ::installedBy );
189
- map .from (properties .getPlaceholders ()).to (configuration ::placeholders );
190
- map .from (properties .getPlaceholderPrefix ()).to (configuration ::placeholderPrefix );
191
- map .from (properties .getPlaceholderSuffix ()).to (configuration ::placeholderSuffix );
192
- // No method reference for compatibility with Flyway version < 8.0
193
+ map .from (properties .getBaselineDescription ())
194
+ .to ((baselineDescription ) -> configuration .baselineDescription (baselineDescription ));
195
+ map .from (properties .getBaselineVersion ())
196
+ .to ((baselineVersion ) -> configuration .baselineVersion (baselineVersion ));
197
+ map .from (properties .getInstalledBy ()).to ((installedBy ) -> configuration .installedBy (installedBy ));
198
+ map .from (properties .getPlaceholders ()).to ((placeholders ) -> configuration .placeholders (placeholders ));
199
+ map .from (properties .getPlaceholderPrefix ())
200
+ .to ((placeholderPrefix ) -> configuration .placeholderPrefix (placeholderPrefix ));
201
+ map .from (properties .getPlaceholderSuffix ())
202
+ .to ((placeholderSuffix ) -> configuration .placeholderSuffix (placeholderSuffix ));
193
203
map .from (properties .getPlaceholderSeparator ())
194
204
.to ((placeHolderSeparator ) -> configuration .placeholderSeparator (placeHolderSeparator ));
195
- map .from (properties .isPlaceholderReplacement ()).to (configuration ::placeholderReplacement );
196
- map .from (properties .getSqlMigrationPrefix ()).to (configuration ::sqlMigrationPrefix );
205
+ map .from (properties .isPlaceholderReplacement ())
206
+ .to ((placeholderReplacement ) -> configuration .placeholderReplacement (placeholderReplacement ));
207
+ map .from (properties .getSqlMigrationPrefix ())
208
+ .to ((sqlMigrationPrefix ) -> configuration .sqlMigrationPrefix (sqlMigrationPrefix ));
197
209
map .from (properties .getSqlMigrationSuffixes ())
198
210
.as (StringUtils ::toStringArray )
199
- .to (configuration ::sqlMigrationSuffixes );
200
- map .from (properties .getSqlMigrationSeparator ()).to (configuration ::sqlMigrationSeparator );
201
- map .from (properties .getRepeatableSqlMigrationPrefix ()).to (configuration ::repeatableSqlMigrationPrefix );
202
- map .from (properties .getTarget ()).to (configuration ::target );
203
- map .from (properties .isBaselineOnMigrate ()).to (configuration ::baselineOnMigrate );
204
- map .from (properties .isCleanDisabled ()).to (configuration ::cleanDisabled );
205
- map .from (properties .isCleanOnValidationError ()).to (configuration ::cleanOnValidationError );
206
- map .from (properties .isGroup ()).to (configuration ::group );
211
+ .to ((sqlMigrationSuffixes ) -> configuration .sqlMigrationSuffixes (sqlMigrationSuffixes ));
212
+ map .from (properties .getSqlMigrationSeparator ())
213
+ .to ((sqlMigrationSeparator ) -> configuration .sqlMigrationSeparator (sqlMigrationSeparator ));
214
+ map .from (properties .getRepeatableSqlMigrationPrefix ())
215
+ .to ((repeatableSqlMigrationPrefix ) -> configuration
216
+ .repeatableSqlMigrationPrefix (repeatableSqlMigrationPrefix ));
217
+ map .from (properties .getTarget ()).to ((target ) -> configuration .target (target ));
218
+ map .from (properties .isBaselineOnMigrate ())
219
+ .to ((baselineOnMigrate ) -> configuration .baselineOnMigrate (baselineOnMigrate ));
220
+ map .from (properties .isCleanDisabled ()).to ((cleanDisabled ) -> configuration .cleanDisabled (cleanDisabled ));
221
+ map .from (properties .isCleanOnValidationError ())
222
+ .to ((cleanOnValidationError ) -> configuration .cleanOnValidationError (cleanOnValidationError ));
223
+ map .from (properties .isGroup ()).to ((group ) -> configuration .group (group ));
207
224
configureIgnoredMigrations (configuration , properties , map );
208
- map .from (properties .isMixed ()).to (configuration ::mixed );
209
- map .from (properties .isOutOfOrder ()).to (configuration ::outOfOrder );
210
- map .from (properties .isSkipDefaultCallbacks ()).to (configuration ::skipDefaultCallbacks );
211
- map .from (properties .isSkipDefaultResolvers ()).to (configuration ::skipDefaultResolvers );
225
+ map .from (properties .isMixed ()).to ((mixed ) -> configuration .mixed (mixed ));
226
+ map .from (properties .isOutOfOrder ()).to ((outOfOrder ) -> configuration .outOfOrder (outOfOrder ));
227
+ map .from (properties .isSkipDefaultCallbacks ())
228
+ .to ((skipDefaultCallbacks ) -> configuration .skipDefaultCallbacks (skipDefaultCallbacks ));
229
+ map .from (properties .isSkipDefaultResolvers ())
230
+ .to ((skipDefaultResolvers ) -> configuration .skipDefaultResolvers (skipDefaultResolvers ));
212
231
configureValidateMigrationNaming (configuration , properties .isValidateMigrationNaming ());
213
- map .from (properties .isValidateOnMigrate ()).to (configuration ::validateOnMigrate );
232
+ map .from (properties .isValidateOnMigrate ())
233
+ .to ((validateOnMigrate ) -> configuration .validateOnMigrate (validateOnMigrate ));
214
234
map .from (properties .getInitSqls ())
215
235
.whenNot (CollectionUtils ::isEmpty )
216
236
.as ((initSqls ) -> StringUtils .collectionToDelimitedString (initSqls , "\n " ))
217
- .to (configuration :: initSql );
237
+ .to (( initSql ) -> configuration . initSql ( initSql ) );
218
238
map .from (properties .getScriptPlaceholderPrefix ())
219
239
.to ((prefix ) -> configuration .scriptPlaceholderPrefix (prefix ));
220
240
map .from (properties .getScriptPlaceholderSuffix ())
221
241
.to ((suffix ) -> configuration .scriptPlaceholderSuffix (suffix ));
222
242
// Pro properties
223
- map .from (properties .getBatch ()).to (configuration :: batch );
224
- map .from (properties .getDryRunOutput ()).to (configuration :: dryRunOutput );
225
- map .from (properties .getErrorOverrides ()). to ( configuration :: errorOverrides );
226
- map . from ( properties . getLicenseKey ()). to ( configuration :: licenseKey );
227
- // No method reference for compatibility with Flyway 9.20+
243
+ map .from (properties .getBatch ()).to (( batch ) -> configuration . batch ( batch ) );
244
+ map .from (properties .getDryRunOutput ()).to (( dryRunOutput ) -> configuration . dryRunOutput ( dryRunOutput ) );
245
+ map .from (properties .getErrorOverrides ())
246
+ . to (( errorOverrides ) -> configuration . errorOverrides ( errorOverrides ) );
247
+ map . from ( properties . getLicenseKey ()). to (( licenseKey ) -> configuration . licenseKey ( licenseKey ));
228
248
map .from (properties .getOracleSqlplus ()).to ((oracleSqlplus ) -> configuration .oracleSqlplus (oracleSqlplus ));
229
- // No method reference for compatibility with Flyway 5.x
230
249
map .from (properties .getOracleSqlplusWarn ())
231
250
.to ((oracleSqlplusWarn ) -> configuration .oracleSqlplusWarn (oracleSqlplusWarn ));
232
- map .from (properties .getStream ()).to (configuration :: stream );
233
- map .from (properties .getUndoSqlMigrationPrefix ()). to ( configuration :: undoSqlMigrationPrefix );
234
- // No method reference for compatibility with Flyway 6.x
251
+ map .from (properties .getStream ()).to (( stream ) -> configuration . stream ( stream ) );
252
+ map .from (properties .getUndoSqlMigrationPrefix ())
253
+ . to (( undoSqlMigrationPrefix ) -> configuration . undoSqlMigrationPrefix ( undoSqlMigrationPrefix ));
235
254
map .from (properties .getCherryPick ()).to ((cherryPick ) -> configuration .cherryPick (cherryPick ));
236
- // No method reference for compatibility with Flyway 6.x
237
255
map .from (properties .getJdbcProperties ())
238
256
.whenNot (Map ::isEmpty )
239
257
.to ((jdbcProperties ) -> configuration .jdbcProperties (jdbcProperties ));
240
- // No method reference for compatibility with Flyway 6.x
241
258
map .from (properties .getKerberosConfigFile ())
242
259
.to ((configFile ) -> configuration .kerberosConfigFile (configFile ));
243
- // No method reference for compatibility with Flyway 6.x
244
260
map .from (properties .getOracleKerberosCacheFile ())
245
261
.to ((cacheFile ) -> configuration .oracleKerberosCacheFile (cacheFile ));
246
- // No method reference for compatibility with Flyway 6.x
247
262
map .from (properties .getOutputQueryResults ())
248
263
.to ((outputQueryResults ) -> configuration .outputQueryResults (outputQueryResults ));
249
264
map .from (properties .getSqlServerKerberosLoginFile ())
250
265
.whenNonNull ()
251
266
.to (this ::configureSqlServerKerberosLoginFile );
252
- // No method reference for compatibility with Flyway 6.x
253
267
map .from (properties .getSkipExecutingMigrations ())
254
268
.to ((skipExecutingMigrations ) -> configuration .skipExecutingMigrations (skipExecutingMigrations ));
255
- // No method reference for compatibility with Flyway < 7.8
256
269
map .from (properties .getIgnoreMigrationPatterns ())
257
270
.whenNot (List ::isEmpty )
258
271
.to ((ignoreMigrationPatterns ) -> configuration
259
272
.ignoreMigrationPatterns (ignoreMigrationPatterns .toArray (new String [0 ])));
260
- // No method reference for compatibility with Flyway version < 7.9
261
273
map .from (properties .getDetectEncoding ())
262
274
.to ((detectEncoding ) -> configuration .detectEncoding (detectEncoding ));
263
- // No method reference for compatibility with Flyway version < 8.0
264
275
map .from (properties .getBaselineMigrationPrefix ())
265
276
.to ((baselineMigrationPrefix ) -> configuration .baselineMigrationPrefix (baselineMigrationPrefix ));
266
277
}
0 commit comments