Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
1d610fe1
Commit
1d610fe1
authored
Oct 05, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add configuration properties for Flyway 7's new config options
Closes gh-23579
parent
847aecf6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
3 deletions
+137
-3
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+15
-0
FlywayProperties.java
...framework/boot/autoconfigure/flyway/FlywayProperties.java
+67
-0
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+55
-0
FlywayPropertiesTests.java
...work/boot/autoconfigure/flyway/FlywayPropertiesTests.java
+0
-3
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
1d610fe1
...
@@ -21,6 +21,7 @@ import java.util.Collection;
...
@@ -21,6 +21,7 @@ import java.util.Collection;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.function.Supplier
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -220,6 +221,20 @@ public class FlywayAutoConfiguration {
...
@@ -220,6 +221,20 @@ public class FlywayAutoConfiguration {
.
to
((
oracleSqlplusWarn
)
->
configuration
.
oracleSqlplusWarn
(
oracleSqlplusWarn
));
.
to
((
oracleSqlplusWarn
)
->
configuration
.
oracleSqlplusWarn
(
oracleSqlplusWarn
));
map
.
from
(
properties
.
getStream
()).
whenNonNull
().
to
(
configuration:
:
stream
);
map
.
from
(
properties
.
getStream
()).
whenNonNull
().
to
(
configuration:
:
stream
);
map
.
from
(
properties
.
getUndoSqlMigrationPrefix
()).
whenNonNull
().
to
(
configuration:
:
undoSqlMigrationPrefix
);
map
.
from
(
properties
.
getUndoSqlMigrationPrefix
()).
whenNonNull
().
to
(
configuration:
:
undoSqlMigrationPrefix
);
// No method reference for compatibility with Flyway 6.x
map
.
from
(
properties
.
getCherryPick
()).
whenNonNull
().
to
((
cherryPick
)
->
configuration
.
cherryPick
(
cherryPick
));
// No method reference for compatibility with Flyway 6.x
map
.
from
(
properties
.
getJdbcProperties
()).
whenNot
(
Map:
:
isEmpty
)
.
to
((
jdbcProperties
)
->
configuration
.
jdbcProperties
(
jdbcProperties
));
// No method reference for compatibility with Flyway 6.x
map
.
from
(
properties
.
getOracleKerberosCacheFile
()).
whenNonNull
()
.
to
((
cacheFile
)
->
configuration
.
orackeKerberosCacheFile
(
cacheFile
));
// No method reference for compatibility with Flyway 6.x
map
.
from
(
properties
.
getOracleKerberosConfigFile
()).
whenNonNull
()
.
to
((
configFile
)
->
configuration
.
orackeKerberosConfigFile
(
configFile
));
// No method reference for compatibility with Flyway 6.x
map
.
from
(
properties
.
getSkipExecutingMigrations
()).
whenNonNull
()
.
to
((
skipExecutingMigrations
)
->
configuration
.
skipExecutingMigrations
(
skipExecutingMigrations
));
}
}
private
void
configureCreateSchemas
(
FluentConfiguration
configuration
,
boolean
createSchemas
)
{
private
void
configureCreateSchemas
(
FluentConfiguration
configuration
,
boolean
createSchemas
)
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
View file @
1d610fe1
...
@@ -290,6 +290,33 @@ public class FlywayProperties {
...
@@ -290,6 +290,33 @@ public class FlywayProperties {
*/
*/
private
String
undoSqlMigrationPrefix
;
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.
*/
private
Map
<
String
,
String
>
jdbcProperties
=
new
HashMap
<>();
/**
* Path of the Oracle Kerberos cache file. Requires Flyway Teams.
*/
private
String
oracleKerberosCacheFile
;
/**
* Path of the Oracle Kerberos config file. Requires Flyway Teams.
*/
private
String
oracleKerberosConfigFile
;
/**
* Whether Flyway should skip executing the contents of the migrations and only update
* the schema history table. Requires Flyway teams.
*/
private
Boolean
skipExecutingMigrations
;
public
boolean
isEnabled
()
{
public
boolean
isEnabled
()
{
return
this
.
enabled
;
return
this
.
enabled
;
}
}
...
@@ -678,4 +705,44 @@ public class FlywayProperties {
...
@@ -678,4 +705,44 @@ public class FlywayProperties {
this
.
undoSqlMigrationPrefix
=
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
;
}
public
void
setJdbcProperties
(
Map
<
String
,
String
>
jdbcProperties
)
{
this
.
jdbcProperties
=
jdbcProperties
;
}
public
String
getOracleKerberosCacheFile
()
{
return
this
.
oracleKerberosCacheFile
;
}
public
void
setOracleKerberosCacheFile
(
String
oracleKerberosCacheFile
)
{
this
.
oracleKerberosCacheFile
=
oracleKerberosCacheFile
;
}
public
String
getOracleKerberosConfigFile
()
{
return
this
.
oracleKerberosConfigFile
;
}
public
void
setOracleKerberosConfigFile
(
String
oracleKerberosConfigFile
)
{
this
.
oracleKerberosConfigFile
=
oracleKerberosConfigFile
;
}
public
Boolean
getSkipExecutingMigrations
()
{
return
this
.
skipExecutingMigrations
;
}
public
void
setSkipExecutingMigrations
(
Boolean
skipExecutingMigrations
)
{
this
.
skipExecutingMigrations
=
skipExecutingMigrations
;
}
}
}
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
1d610fe1
...
@@ -519,6 +519,61 @@ class FlywayAutoConfigurationTests {
...
@@ -519,6 +519,61 @@ class FlywayAutoConfigurationTests {
});
});
}
}
@Test
void
cherryPickIsCorrectlyMapped
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.cherry-pick=1.1"
).
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
Throwable
failure
=
context
.
getStartupFailure
();
assertThat
(
failure
).
hasRootCauseInstanceOf
(
FlywayTeamsUpgradeRequiredException
.
class
);
assertThat
(
failure
).
hasMessageContaining
(
" migrations "
);
});
}
@Test
void
jdbcPropertiesAreCorrectlyMapped
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.jdbc-properties.prop=value"
).
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
Throwable
failure
=
context
.
getStartupFailure
();
assertThat
(
failure
).
hasRootCauseInstanceOf
(
FlywayTeamsUpgradeRequiredException
.
class
);
assertThat
(
failure
).
hasMessageContaining
(
" jdbcProperties "
);
});
}
@Test
void
oracleKerberosCacheFileIsCorrectlyMapped
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.oracle-kerberos-cache-file=/tmp/cache"
).
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
Throwable
failure
=
context
.
getStartupFailure
();
assertThat
(
failure
).
hasRootCauseInstanceOf
(
FlywayTeamsUpgradeRequiredException
.
class
);
assertThat
(
failure
).
hasMessageContaining
(
" oracle.kerberosCacheFile "
);
});
}
@Test
void
oracleKerberosConfigFileIsCorrectlyMapped
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.oracle-kerberos-config-file=/tmp/config"
).
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
Throwable
failure
=
context
.
getStartupFailure
();
assertThat
(
failure
).
hasRootCauseInstanceOf
(
FlywayTeamsUpgradeRequiredException
.
class
);
assertThat
(
failure
).
hasMessageContaining
(
" oracle.kerberosConfigFile "
);
});
}
@Test
void
skipExecutingMigrationsIsCorrectlyMapped
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.skip-executing-migrations=true"
).
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
Throwable
failure
=
context
.
getStartupFailure
();
assertThat
(
failure
).
hasRootCauseInstanceOf
(
FlywayTeamsUpgradeRequiredException
.
class
);
assertThat
(
failure
).
hasMessageContaining
(
" skipExecutingMigrations "
);
});
}
@Configuration
(
proxyBeanMethods
=
false
)
@Configuration
(
proxyBeanMethods
=
false
)
static
class
FlywayDataSourceConfiguration
{
static
class
FlywayDataSourceConfiguration
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java
View file @
1d610fe1
...
@@ -115,9 +115,6 @@ class FlywayPropertiesTests {
...
@@ -115,9 +115,6 @@ class FlywayPropertiesTests {
ignoreProperties
(
configuration
,
"shouldCreateSchemas"
);
ignoreProperties
(
configuration
,
"shouldCreateSchemas"
);
// Getters for the DataSource settings rather than actual properties
// Getters for the DataSource settings rather than actual properties
ignoreProperties
(
configuration
,
"password"
,
"url"
,
"user"
);
ignoreProperties
(
configuration
,
"password"
,
"url"
,
"user"
);
// Flyway 7.0 properties that are not yet supported
ignoreProperties
(
configuration
,
"cherryPick"
,
"jdbcProperties"
,
"oracleKerberosCacheFile"
,
"oracleKerberosConfigFile"
,
"skipExecutingMigrations"
);
List
<
String
>
configurationKeys
=
new
ArrayList
<>(
configuration
.
keySet
());
List
<
String
>
configurationKeys
=
new
ArrayList
<>(
configuration
.
keySet
());
Collections
.
sort
(
configurationKeys
);
Collections
.
sort
(
configurationKeys
);
List
<
String
>
propertiesKeys
=
new
ArrayList
<>(
properties
.
keySet
());
List
<
String
>
propertiesKeys
=
new
ArrayList
<>(
properties
.
keySet
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment