-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
ChangelogSyncSqlCommandStep.java
62 lines (53 loc) · 3.31 KB
/
ChangelogSyncSqlCommandStep.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package liquibase.command.core;
import liquibase.command.*;
import liquibase.configuration.ConfigurationValueObfuscator;
import liquibase.exception.CommandExecutionException;
public class ChangelogSyncSqlCommandStep extends AbstractCliWrapperCommandStep {
public static final String[] COMMAND_NAME = {"changelogSyncSql"};
public static final CommandArgumentDefinition<String> CHANGELOG_FILE_ARG;
public static final CommandArgumentDefinition<String> URL_ARG;
public static final CommandArgumentDefinition<String> DEFAULT_SCHEMA_NAME_ARG;
public static final CommandArgumentDefinition<String> DEFAULT_CATALOG_NAME_ARG;
public static final CommandArgumentDefinition<String> USERNAME_ARG;
public static final CommandArgumentDefinition<String> PASSWORD_ARG;
public static final CommandArgumentDefinition<String> LABELS_ARG;
public static final CommandArgumentDefinition<String> CONTEXTS_ARG;
public static final CommandArgumentDefinition<String> DRIVER_ARG;
public static final CommandArgumentDefinition<String> DRIVER_PROPERTIES_FILE_ARG;
static {
CommandBuilder builder = new CommandBuilder(COMMAND_NAME);
CHANGELOG_FILE_ARG = builder.argument(CommonArgumentNames.CHANGELOG_FILE, String.class).required()
.description("The root changelog file").build();
URL_ARG = builder.argument(CommonArgumentNames.URL, String.class).required()
.description("The JDBC database connection URL").build();
DEFAULT_SCHEMA_NAME_ARG = builder.argument("defaultSchemaName", String.class)
.description("The default schema name to use for the database connection").build();
DEFAULT_CATALOG_NAME_ARG = builder.argument("defaultCatalogName", String.class)
.description("The default catalog name to use for the database connection").build();
DRIVER_ARG = builder.argument("driver", String.class)
.description("The JDBC driver class").build();
DRIVER_PROPERTIES_FILE_ARG = builder.argument("driverPropertiesFile", String.class)
.description("The JDBC driver properties file").build();
USERNAME_ARG = builder.argument(CommonArgumentNames.USERNAME, String.class)
.description("The database username").build();
PASSWORD_ARG = builder.argument(CommonArgumentNames.PASSWORD, String.class)
.setValueObfuscator(ConfigurationValueObfuscator.STANDARD)
.description("The database password").build();
LABELS_ARG = builder.argument("labels", String.class)
.description("Label expression to use for filtering which changes to mark as executed").build();
CONTEXTS_ARG = builder.argument("contexts", String.class)
.description("Context string to use for filtering which changes to mark as executed").build();
}
@Override
public String[][] defineCommandNames() {
return new String[][] { COMMAND_NAME};
}
@Override
public void adjustCommandDefinition(CommandDefinition commandDefinition) {
commandDefinition.setShortDescription("Output the raw SQL used by Liquibase when running changelogSync");
}
@Override
protected String[] collectArguments(CommandScope commandScope) throws CommandExecutionException {
return collectArguments(commandScope, null, null);
}
}