All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.command.core.DiffChangelogCommandStep Maven / Gradle / Ivy

package liquibase.command.core;

import liquibase.command.*;
import liquibase.configuration.ConfigurationValueObfuscator;
import liquibase.exception.CommandExecutionException;

public class DiffChangelogCommandStep extends AbstractCliWrapperCommandStep {

    public static final String[] COMMAND_NAME = {"diffChangelog"};

    public static final CommandArgumentDefinition REFERENCE_USERNAME_ARG;
    public static final CommandArgumentDefinition REFERENCE_PASSWORD_ARG;
    public static final CommandArgumentDefinition REFERENCE_URL_ARG;
    public static final CommandArgumentDefinition REFERENCE_DEFAULT_CATALOG_NAME_ARG;
    public static final CommandArgumentDefinition REFERENCE_DEFAULT_SCHEMA_NAME_ARG;
    public static final CommandArgumentDefinition USERNAME_ARG;
    public static final CommandArgumentDefinition PASSWORD_ARG;
    public static final CommandArgumentDefinition URL_ARG;
    public static final CommandArgumentDefinition DEFAULT_CATALOG_NAME_ARG;
    public static final CommandArgumentDefinition DEFAULT_SCHEMA_NAME_ARG;
    public static final CommandArgumentDefinition CHANGELOG_FILE_ARG;
    public static final CommandArgumentDefinition EXCLUDE_OBJECTS_ARG;
    public static final CommandArgumentDefinition INCLUDE_OBJECTS_ARG;
    public static final CommandArgumentDefinition INCLUDE_TABLESPACE_ARG;
    public static final CommandArgumentDefinition SCHEMAS_ARG;
    public static final CommandArgumentDefinition INCLUDE_SCHEMA_ARG;
    public static final CommandArgumentDefinition INCLUDE_CATALOG_ARG;
    public static final CommandArgumentDefinition DIFF_TYPES_ARG;
    public static final CommandArgumentDefinition DRIVER_ARG;
    public static final CommandArgumentDefinition DRIVER_PROPERTIES_FILE_ARG;

    static {
        CommandBuilder builder = new CommandBuilder(COMMAND_NAME);
        REFERENCE_URL_ARG = builder.argument("referenceUrl", String.class).required()
                .description("The JDBC reference database connection URL").build();
        REFERENCE_USERNAME_ARG = builder.argument("referenceUsername", String.class)
                .description("The reference database username").build();
        REFERENCE_PASSWORD_ARG = builder.argument("referencePassword", String.class)
                .description("The reference database password")
                .setValueObfuscator(ConfigurationValueObfuscator.STANDARD).build();
        REFERENCE_DEFAULT_SCHEMA_NAME_ARG = builder.argument("referenceDefaultSchemaName", String.class)
                .description("The reference default schema name to use for the database connection").build();
        REFERENCE_DEFAULT_CATALOG_NAME_ARG = builder.argument("referenceDefaultCatalogName", String.class)
                .description("The reference default catalog name to use for the database connection").build();
        URL_ARG = builder.argument(CommonArgumentNames.URL, String.class).required()
                .description("The JDBC target 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 target database username").build();
        PASSWORD_ARG = builder.argument(CommonArgumentNames.PASSWORD, String.class)
                .description("The target database password")
                .setValueObfuscator(ConfigurationValueObfuscator.STANDARD)
                .build();
        CHANGELOG_FILE_ARG = builder.argument(CommonArgumentNames.CHANGELOG_FILE, String.class).required()
                .description("Changelog file to write results").build();
        EXCLUDE_OBJECTS_ARG = builder.argument("excludeObjects", String.class)
                .description("Objects to exclude from diff").build();
        INCLUDE_OBJECTS_ARG = builder.argument("includeObjects", String.class)
                .description("Objects to include in diff").build();
        INCLUDE_TABLESPACE_ARG = builder.argument("includeTablespace", String.class)
            .description("Include the tablespace attribute in the changelog").build();
        SCHEMAS_ARG = builder.argument("schemas", String.class)
                .description("Schemas to include in diff").build();
        INCLUDE_SCHEMA_ARG = builder.argument("includeSchema", Boolean.class)
                .defaultValue(false)
                .description("If true, the schema will be included in generated changeSets").build();
        INCLUDE_CATALOG_ARG = builder.argument("includeCatalog", Boolean.class)
                .defaultValue(false)
                .description("If true, the catalog will be included in generated changeSets").build();
        DIFF_TYPES_ARG = builder.argument("diffTypes", String.class)
                .description("Types of objects to compare").build();
    }

    @Override
    public String[][] defineCommandNames() {
        return new String[][] { COMMAND_NAME};
    }

    @Override
    public void adjustCommandDefinition(CommandDefinition commandDefinition) {
        commandDefinition.setShortDescription("Compare two databases to produce changesets and write them to a changelog file");
    }

    @Override
    protected String[] collectArguments(CommandScope commandScope) throws CommandExecutionException {
        return collectArguments(commandScope, null, null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy