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
7865233b
Commit
7865233b
authored
Jul 24, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Flyway filesystem prefix location check
Co-authored-by:
Andy Bell
<
andyrbell@gmail.com
>
Closes gh-13863
parent
f1cf41f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+5
-1
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+12
-2
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+12
-2
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
7865233b
...
...
@@ -117,13 +117,17 @@ public class FlywayAutoConfiguration {
private
boolean
hasAtLeastOneLocation
()
{
for
(
String
location
:
this
.
properties
.
getLocations
())
{
if
(
this
.
resourceLoader
.
getResource
(
location
).
exists
())
{
if
(
this
.
resourceLoader
.
getResource
(
normalizePrefix
(
location
)
).
exists
())
{
return
true
;
}
}
return
false
;
}
private
String
normalizePrefix
(
String
location
)
{
return
location
.
replace
(
"filesystem:"
,
"file:"
);
}
@Bean
@ConfigurationProperties
(
prefix
=
"flyway"
)
public
Flyway
flyway
()
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
7865233b
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -153,7 +153,7 @@ public class FlywayAutoConfigurationTests {
@Test
public
void
changeLogDoesNotExist
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"flyway.locations:file:no-such-dir"
);
"flyway.locations:file
system
:no-such-dir"
);
this
.
thrown
.
expect
(
BeanCreationException
.
class
);
registerAndRefresh
(
EmbeddedDataSourceConfiguration
.
class
,
FlywayAutoConfiguration
.
class
,
...
...
@@ -192,6 +192,16 @@ public class FlywayAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration
.
class
);
}
@Test
public
void
checkLocationsAllExistWithImplicitFilesystemPrefix
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"flyway.locations:filesystem:src/test/resources/db/migration"
,
"flyway.check-location:true"
);
registerAndRefresh
(
EmbeddedDataSourceConfiguration
.
class
,
FlywayAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
}
@Test
public
void
customFlywayMigrationStrategy
()
throws
Exception
{
registerAndRefresh
(
EmbeddedDataSourceConfiguration
.
class
,
...
...
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
7865233b
...
...
@@ -2246,8 +2246,18 @@ To automatically run Flyway database migrations on startup, add the
The migrations are scripts in the form `V<VERSION>__<NAME>.sql` (with `<VERSION>` an
underscore-separated version, e.g. '`1`' or '`2_1`'). By default they live in a folder
`classpath:db/migration` but you can modify that using `flyway.locations`. You can also
add a special `{vendor}` placeholder to use vendor-specific scripts. Assume the following:
`classpath:db/migration` but you can modify that using `flyway.locations`. This is a
comma-separated list of one or more `classpath:` or `filesystem:` locations. For example,
the following configuration would search for scripts in both the default classpath
location and the `/opt/migration` directory:
[source,properties,indent=0]
----
spring.flyway.locations=classpath:db/migration,filesystem:/opt/migration
----
You can also add a special `{vendor}` placeholder to use vendor-specific scripts. Assume
the following:
[source,properties,indent=0]
----
...
...
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