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
05acfaa6
Commit
05acfaa6
authored
May 31, 2021
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Upgrade to Flyway 7.9.2"
See gh-26456
parent
e6236b76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
5 deletions
+48
-5
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+1
-1
FlywayProperties.java
...framework/boot/autoconfigure/flyway/FlywayProperties.java
+3
-4
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+44
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
05acfaa6
...
...
@@ -258,7 +258,7 @@ public class FlywayAutoConfiguration {
.
to
((
ignoreMigrationPatterns
)
->
configuration
.
ignoreMigrationPatterns
(
ignoreMigrationPatterns
.
toArray
(
new
String
[
0
])));
// No method reference for compatibility with Flyway version < 7.9
map
.
from
(
properties
.
getDetectEncoding
())
.
whenNonNull
()
map
.
from
(
properties
.
getDetectEncoding
())
.
to
((
detectEncoding
)
->
configuration
.
detectEncoding
(
detectEncoding
));
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
View file @
05acfaa6
...
...
@@ -53,8 +53,7 @@ public class FlywayProperties {
private
boolean
checkLocation
=
true
;
/**
* Whether Flyway should fail if a location specified in the flyway.locations option
* doesn't exist.
* Whether to fail if a location of migration scripts doesn't exist.
*/
private
boolean
failOnMissingLocations
;
...
...
@@ -368,8 +367,8 @@ public class FlywayProperties {
private
List
<
String
>
ignoreMigrationPatterns
;
/**
* Whether
Flyway should try to automatically detect SQL migration file encoding.
*
Requires
Flyway Teams.
* Whether
to attempt to automatically detect SQL migration file encoding. Requires
* Flyway Teams.
*/
private
Boolean
detectEncoding
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
05acfaa6
...
...
@@ -288,6 +288,7 @@ class FlywayAutoConfigurationTests {
}
@Test
@Deprecated
void
checkLocationsAllMissing
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.locations:classpath:db/missing1,classpath:db/migration2"
)
...
...
@@ -299,6 +300,7 @@ class FlywayAutoConfigurationTests {
}
@Test
@Deprecated
void
checkLocationsAllExist
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.locations:classpath:db/changelog,classpath:db/migration"
)
...
...
@@ -306,6 +308,7 @@ class FlywayAutoConfigurationTests {
}
@Test
@Deprecated
void
checkLocationsAllExistWithImplicitClasspathPrefix
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.locations:db/changelog,db/migration"
)
...
...
@@ -313,12 +316,53 @@ class FlywayAutoConfigurationTests {
}
@Test
@Deprecated
void
checkLocationsAllExistWithFilesystemPrefix
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.locations:filesystem:src/test/resources/db/migration"
)
.
run
((
context
)
->
assertThat
(
context
).
hasNotFailed
());
}
@Test
void
failOnMissingLocationsAllMissing
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.check-location=false"
,
"spring.flyway.fail-on-missing-locations=true"
)
.
withPropertyValues
(
"spring.flyway.locations:classpath:db/missing1,classpath:db/migration2"
)
.
run
((
context
)
->
{
assertThat
(
context
).
hasFailed
();
assertThat
(
context
).
getFailure
().
isInstanceOf
(
BeanCreationException
.
class
);
assertThat
(
context
).
getFailure
().
hasMessageContaining
(
"Unable to resolve location"
);
});
}
@Test
void
failOnMissingLocationsAllExist
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.check-location=false"
,
"spring.flyway.fail-on-missing-locations=true"
)
.
withPropertyValues
(
"spring.flyway.locations:classpath:db/changelog,classpath:db/migration"
)
.
run
((
context
)
->
assertThat
(
context
).
hasNotFailed
());
}
@Test
void
failOnMissingLocationsAllExistWithImplicitClasspathPrefix
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.check-location=false"
,
"spring.flyway.fail-on-missing-locations=true"
)
.
withPropertyValues
(
"spring.flyway.locations:db/changelog,db/migration"
)
.
run
((
context
)
->
assertThat
(
context
).
hasNotFailed
());
}
@Test
void
failOnMissingLocationsAllExistWithFilesystemPrefix
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.check-location=false"
,
"spring.flyway.fail-on-missing-locations=true"
)
.
withPropertyValues
(
"spring.flyway.locations:filesystem:src/test/resources/db/migration"
)
.
run
((
context
)
->
assertThat
(
context
).
hasNotFailed
());
}
@Test
void
customFlywayMigrationStrategy
()
{
this
.
contextRunner
...
...
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