Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify target migrate version to match the default behavior #2224

voronaam opened this issue Nov 30, 2018 · 4 comments


Copy link

commented Nov 30, 2018

I would like to allow a special value of the -target parameter for the migrate operation to specify exactly the same behaviour as when -target parameter is omitted.

Using command-line interface as an example:

flyway -target=${parameters.version} migrate

We would want parameters.version to come as a configurable parameter from an upstream pipeline. However, there is no value for this parameter to match the default behaviour "migrate to the latest".

The -target already has one special value ("current"). I propose another special value. It could be either of "null", "empty", "latest". When specified, FlywayDB migrate behaviour exactly matches one when the -target parameter is omitted.

I will create a PR for this proposal. This can be as simple as:

diff --git a/flyway-core/src/main/java/org/flywaydb/core/api/configuration/ b/flyway-core/src/main/java/org/flywaydb/core/api/configuration/
index 8039bb1d1..d6472810b 100644
--- a/flyway-core/src/main/java/org/flywaydb/core/api/configuration/
+++ b/flyway-core/src/main/java/org/flywaydb/core/api/configuration/
@@ -1577,7 +1577,7 @@ public class ClassicConfiguration implements Configuration {
         String targetProp = props.remove(ConfigUtils.TARGET);
-        if (targetProp != null) {
+        if (targetProp != null && !"null".equalsIgnoreCase(targetProp)) {
         Boolean outOfOrderProp = getBooleanProp(props, ConfigUtils.OUT_OF_ORDER);

This comment has been minimized.

Copy link

commented Dec 4, 2018

We will use the special value latest for this. We'll implement this as part of 6.0.


This comment has been minimized.

Copy link

commented Dec 4, 2018

Thank you.

The naming is the hardest part for me. I am not in any way attached to the null value I used in the PR :)

Updated the PR to match the selected value.


This comment has been minimized.

Copy link

commented Jan 15, 2019

I closed the Pull Request - looks like you are going to address the change inside your own team.


This comment has been minimized.

Copy link

commented Aug 2, 2019

Thanks for the feature request. From V6, this will be possible via a new special value latest for the 'target' configuration option. So you could do something like:

flyway -target=latest migrate

The option will also register for other commands (undo, info, etc) also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.