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
6c29b29b
Commit
6c29b29b
authored
Jun 26, 2020
by
Kedar Joshi
Committed by
Andy Wilkinson
Jun 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to Flyway 6.5.0 and support createSchemas
See gh-22120
parent
f6400e95
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+10
-0
FlywayProperties.java
...framework/boot/autoconfigure/flyway/FlywayProperties.java
+14
-0
FlywayPropertiesTests.java
...work/boot/autoconfigure/flyway/FlywayPropertiesTests.java
+5
-1
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 @
6c29b29b
...
...
@@ -178,6 +178,7 @@ public class FlywayAutoConfiguration {
// No method reference for compatibility with Flyway 5.x
map
.
from
(
properties
.
getDefaultSchema
()).
to
((
schema
)
->
configuration
.
defaultSchema
(
schema
));
map
.
from
(
properties
.
getSchemas
()).
as
(
StringUtils:
:
toStringArray
).
to
(
configuration:
:
schemas
);
configureCreateSchemas
(
configuration
,
properties
.
isCreateSchemas
());
map
.
from
(
properties
.
getTable
()).
to
(
configuration:
:
table
);
// No method reference for compatibility with Flyway 5.x
map
.
from
(
properties
.
getTablespace
()).
whenNonNull
().
to
((
tablespace
)
->
configuration
.
tablespace
(
tablespace
));
...
...
@@ -221,6 +222,15 @@ public class FlywayAutoConfiguration {
map
.
from
(
properties
.
getUndoSqlMigrationPrefix
()).
whenNonNull
().
to
(
configuration:
:
undoSqlMigrationPrefix
);
}
private
void
configureCreateSchemas
(
FluentConfiguration
configuration
,
boolean
createSchemas
)
{
try
{
configuration
.
createSchemas
(
createSchemas
);
}
catch
(
NoSuchMethodError
ex
)
{
// Flyway < 6.5
}
}
private
void
configureValidateMigrationNaming
(
FluentConfiguration
configuration
,
boolean
validateMigrationNaming
)
{
try
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
View file @
6c29b29b
...
...
@@ -74,6 +74,12 @@ public class FlywayProperties {
*/
private
List
<
String
>
schemas
=
new
ArrayList
<>();
/**
* Whether Flyway should attempt to create the schemas specified in the schemas
* property.
*/
private
boolean
createSchemas
=
true
;
/**
* Name of the schema history table that will be used by Flyway.
*/
...
...
@@ -343,6 +349,14 @@ public class FlywayProperties {
this
.
schemas
=
schemas
;
}
public
boolean
isCreateSchemas
()
{
return
this
.
createSchemas
;
}
public
void
setCreateSchemas
(
boolean
createSchemas
)
{
this
.
createSchemas
=
createSchemas
;
}
public
String
getTable
()
{
return
this
.
table
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java
View file @
6c29b29b
...
...
@@ -53,6 +53,7 @@ class FlywayPropertiesTests {
assertThat
(
properties
.
getConnectRetries
()).
isEqualTo
(
configuration
.
getConnectRetries
());
assertThat
(
properties
.
getDefaultSchema
()).
isEqualTo
(
configuration
.
getDefaultSchema
());
assertThat
(
properties
.
getSchemas
()).
isEqualTo
(
Arrays
.
asList
(
configuration
.
getSchemas
()));
assertThat
(
properties
.
isCreateSchemas
()).
isEqualTo
(
configuration
.
getCreateSchemas
());
assertThat
(
properties
.
getTable
()).
isEqualTo
(
configuration
.
getTable
());
assertThat
(
properties
.
getBaselineDescription
()).
isEqualTo
(
configuration
.
getBaselineDescription
());
assertThat
(
MigrationVersion
.
fromVersion
(
properties
.
getBaselineVersion
()))
...
...
@@ -98,7 +99,8 @@ class FlywayPropertiesTests {
ignoreProperties
(
properties
,
"url"
,
"user"
,
"password"
,
"enabled"
,
"checkLocation"
,
"createDataSource"
);
// High level object we can't set with properties
ignoreProperties
(
configuration
,
"callbacks"
,
"classLoader"
,
"dataSource"
,
"javaMigrations"
,
"resolvers"
);
ignoreProperties
(
configuration
,
"callbacks"
,
"classLoader"
,
"dataSource"
,
"javaMigrations"
,
"javaMigrationClassProvider"
,
"resourceProvider"
,
"resolvers"
);
// Properties we don't want to expose
ignoreProperties
(
configuration
,
"resolversAsClassNames"
,
"callbacksAsClassNames"
);
// Handled by the conversion service
...
...
@@ -109,6 +111,8 @@ class FlywayPropertiesTests {
ignoreProperties
(
properties
,
"initSqls"
);
// Handled as dryRunOutput
ignoreProperties
(
configuration
,
"dryRunOutputAsFile"
,
"dryRunOutputAsFileName"
);
// Handled as createSchemas
ignoreProperties
(
configuration
,
"shouldCreateSchemas"
);
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 @
6c29b29b
...
...
@@ -310,7 +310,7 @@ bom {
]
}
}
library
(
"Flyway"
,
"6.
4.4
"
)
{
library
(
"Flyway"
,
"6.
5.0
"
)
{
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