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
e6236b76
Commit
e6236b76
authored
May 13, 2021
by
Kedar Joshi
Committed by
Stephane Nicoll
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to Flyway 7.9.2
See gh-26456
parent
59852340
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
1 deletion
+65
-1
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+18
-0
FlywayProperties.java
...framework/boot/autoconfigure/flyway/FlywayProperties.java
+42
-0
FlywayPropertiesTests.java
...work/boot/autoconfigure/flyway/FlywayPropertiesTests.java
+4
-0
build.gradle
spring-boot-project/spring-boot-dependencies/build.gradle
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
e6236b76
...
...
@@ -175,6 +175,7 @@ public class FlywayAutoConfiguration {
PropertyMapper
map
=
PropertyMapper
.
get
().
alwaysApplyingWhenNonNull
();
String
[]
locations
=
new
LocationResolver
(
configuration
.
getDataSource
())
.
resolveLocations
(
properties
.
getLocations
()).
toArray
(
new
String
[
0
]);
configureFailOnMissingLocations
(
configuration
,
properties
.
isFailOnMissingLocations
());
map
.
from
(
locations
).
to
(
configuration:
:
locations
);
map
.
from
(
properties
.
getEncoding
()).
to
(
configuration:
:
encoding
);
map
.
from
(
properties
.
getConnectRetries
()).
to
(
configuration:
:
connectRetries
);
...
...
@@ -252,6 +253,23 @@ public class FlywayAutoConfiguration {
map
.
from
(
properties
.
getVaultToken
()).
to
((
vaultToken
)
->
configuration
.
vaultToken
(
vaultToken
));
map
.
from
(
properties
.
getVaultSecrets
()).
whenNot
(
List:
:
isEmpty
)
.
to
((
vaultSecrets
)
->
configuration
.
vaultSecrets
(
vaultSecrets
.
toArray
(
new
String
[
0
])));
// No method reference for compatibility with Flyway < 7.8
map
.
from
(
properties
.
getIgnoreMigrationPatterns
()).
whenNot
(
List:
:
isEmpty
)
.
to
((
ignoreMigrationPatterns
)
->
configuration
.
ignoreMigrationPatterns
(
ignoreMigrationPatterns
.
toArray
(
new
String
[
0
])));
// No method reference for compatibility with Flyway version < 7.9
map
.
from
(
properties
.
getDetectEncoding
()).
whenNonNull
()
.
to
((
detectEncoding
)
->
configuration
.
detectEncoding
(
detectEncoding
));
}
private
void
configureFailOnMissingLocations
(
FluentConfiguration
configuration
,
boolean
failOnMissingLocations
)
{
try
{
configuration
.
failOnMissingLocations
(
failOnMissingLocations
);
}
catch
(
NoSuchMethodError
ex
)
{
// Flyway < 7.9
}
}
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 @
e6236b76
...
...
@@ -52,6 +52,12 @@ public class FlywayProperties {
@Deprecated
private
boolean
checkLocation
=
true
;
/**
* Whether Flyway should fail if a location specified in the flyway.locations option
* doesn't exist.
*/
private
boolean
failOnMissingLocations
;
/**
* Locations of migrations scripts. Can contain the special "{vendor}" placeholder to
* use vendor-specific locations.
...
...
@@ -355,6 +361,18 @@ public class FlywayProperties {
*/
private
List
<
String
>
vaultSecrets
;
/**
* Ignore migrations that match this comma-separated list of patterns when validating
* migrations. Requires Flyway Teams.
*/
private
List
<
String
>
ignoreMigrationPatterns
;
/**
* Whether Flyway should try to automatically detect SQL migration file encoding.
* Requires Flyway Teams.
*/
private
Boolean
detectEncoding
;
public
boolean
isEnabled
()
{
return
this
.
enabled
;
}
...
...
@@ -375,6 +393,14 @@ public class FlywayProperties {
this
.
checkLocation
=
checkLocation
;
}
public
boolean
isFailOnMissingLocations
()
{
return
this
.
failOnMissingLocations
;
}
public
void
setFailOnMissingLocations
(
boolean
failOnMissingLocations
)
{
this
.
failOnMissingLocations
=
failOnMissingLocations
;
}
public
List
<
String
>
getLocations
()
{
return
this
.
locations
;
}
...
...
@@ -842,4 +868,20 @@ public class FlywayProperties {
this
.
vaultSecrets
=
vaultSecrets
;
}
public
List
<
String
>
getIgnoreMigrationPatterns
()
{
return
this
.
ignoreMigrationPatterns
;
}
public
void
setIgnoreMigrationPatterns
(
List
<
String
>
ignoreMigrationPatterns
)
{
this
.
ignoreMigrationPatterns
=
ignoreMigrationPatterns
;
}
public
Boolean
getDetectEncoding
()
{
return
this
.
detectEncoding
;
}
public
void
setDetectEncoding
(
final
Boolean
detectEncoding
)
{
this
.
detectEncoding
=
detectEncoding
;
}
}
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java
View file @
e6236b76
...
...
@@ -48,6 +48,7 @@ class FlywayPropertiesTests {
void
defaultValuesAreConsistent
()
{
FlywayProperties
properties
=
new
FlywayProperties
();
Configuration
configuration
=
new
FluentConfiguration
();
assertThat
(
configuration
.
getFailOnMissingLocations
()).
isEqualTo
(
properties
.
isFailOnMissingLocations
());
assertThat
(
properties
.
getLocations
().
stream
().
map
(
Location:
:
new
).
toArray
(
Location
[]::
new
))
.
isEqualTo
(
configuration
.
getLocations
());
assertThat
(
properties
.
getEncoding
()).
isEqualTo
(
configuration
.
getEncoding
());
...
...
@@ -91,6 +92,7 @@ class FlywayPropertiesTests {
assertThat
(
configuration
.
isSkipDefaultResolvers
()).
isEqualTo
(
properties
.
isSkipDefaultResolvers
());
assertThat
(
configuration
.
isValidateMigrationNaming
()).
isEqualTo
(
properties
.
isValidateMigrationNaming
());
assertThat
(
configuration
.
isValidateOnMigrate
()).
isEqualTo
(
properties
.
isValidateOnMigrate
());
assertThat
(
properties
.
getDetectEncoding
()).
isNull
();
}
@Test
...
...
@@ -119,6 +121,8 @@ class FlywayPropertiesTests {
ignoreProperties
(
configuration
,
"shouldCreateSchemas"
);
// Getters for the DataSource settings rather than actual properties
ignoreProperties
(
configuration
,
"password"
,
"url"
,
"user"
);
// Properties not exposed by Flyway
ignoreProperties
(
configuration
,
"failOnMissingTarget"
);
List
<
String
>
configurationKeys
=
new
ArrayList
<>(
configuration
.
keySet
());
Collections
.
sort
(
configurationKeys
);
List
<
String
>
propertiesKeys
=
new
ArrayList
<>(
properties
.
keySet
());
...
...
spring-boot-project/spring-boot-dependencies/build.gradle
View file @
e6236b76
...
...
@@ -306,7 +306,7 @@ bom {
]
}
}
library
(
"Flyway"
,
"7.
7.3
"
)
{
library
(
"Flyway"
,
"7.
9.2
"
)
{
group
(
"org.flywaydb"
)
{
modules
=
[
"flyway-core"
...
...
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