You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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/ClassicConfiguration.java b/flyway-core/src/main/java/org/flywaydb/core/api/configuration/ClassicConfiguration.java
index 8039bb1d1..d6472810b 100644
--- a/flyway-core/src/main/java/org/flywaydb/core/api/configuration/ClassicConfiguration.java
+++ b/flyway-core/src/main/java/org/flywaydb/core/api/configuration/ClassicConfiguration.java
@@ -1577,7 +1577,7 @@ public class ClassicConfiguration implements Configuration {
setIgnoreFutureMigrations(ignoreFutureMigrationsProp);
}
String targetProp = props.remove(ConfigUtils.TARGET);
- if (targetProp != null) {
+ if (targetProp != null && !"null".equalsIgnoreCase(targetProp)) {
setTarget(MigrationVersion.fromVersion(targetProp));
}
Boolean outOfOrderProp = getBooleanProp(props, ConfigUtils.OUT_OF_ORDER);
The text was updated successfully, but these errors were encountered:
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.
dohrayme
pushed a commit
to dohrayme/flyway
that referenced
this issue
Feb 3, 2020
I would like to allow a special value of the
-target
parameter for themigrate
operation to specify exactly the same behaviour as when-target
parameter is omitted.Using command-line interface as an example:
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:
The text was updated successfully, but these errors were encountered: