copy

Note: This is a Liquibase Pro feature, so you need a Liquibase Pro License Key to use it.

The copy subcommand copies a customizable check so that you can run the same check multiple times with different command arguments.

Uses

If you want to run the same check with different values, use copy to make a new version with new values. If enabled, both checks will be run in the same execution.

For example, you can make two copies of the check that scans SQL:

  • SQL should not contain COPY DATABASE
  • SQL should not contain ALTER USER

Liquibase does not allow you to copy static checks because they do not include customization options, and having the same check is redundant.

Note: To view a list of available checks, run liquibase checks show.

Syntax

The command is interactive, and you need to follow the CLI output messages to execute it:

  1. Run the command specifying your values:
  2. liquibase checks copy --check-name=TableColumnLimit

    Note: If you have a checks settings file customized for a specific environment or project, you need to pass that using the --checks-settings-file parameter. If you do not include this parameter, Liquibase uses the default settings file: liquibase.checks-settings.conf. See Use the Checks Settings Configuration File.

  3. Enter the name of the check copy using alphanumeric characters. Also, the name of the copy should differ from the original name.

The command adds the copy of a check to the checks settings file. To execute the check, use the run subcommand.

Command arguments

The following table identifies parameters that are accepted or required by the copy subcommand. If the Default column states "Required," it is required to run the command successfully. If it states "Null," it is an optional command argument. Each command argument helps you narrow down the liquibase checks copy command to ensure that only very specific content is affected by the command.

Tip: For best results, specify all commands and parameters in the --kebab-case format in the CLI. If your preference is camelCase, it also works in the CLI.

Command Arg Default Syntax Description
checkName (String) Required

CLI: --check-name

Property: liquibase.command.checks.copy.checkName

Environment Variable: LIQUIBASE_COMMAND_CHECKS_COPY_CHECK_NAME

Use this to specify the short name of the check you want to target with one of the following subcommands:

  • bulk-set
  • copy
  • customize
  • delete
  • disable
  • enable
  • reset
  • run
  • show
autoUpdate (String) null

CLI: --auto-update=[on|off]

Property: liquibase.command.checks.copy.autoUpdate: [on|off]

Environment Variable: LIQUIBASE_COMMAND_CHECKS_COPY_AUTO_UPDATE=[ON|OFF]

Allows automatic backup and updating of liquibase.checks.conf file when new quality checks are available. Options: [on|off]
checksSettingsFile (String) null

CLI: --checks-settings-file

Property: liquibase.command.checks.<SUBCOMMAND>.checksSettingsFile

Environment Variable: LIQUIBASE_COMMAND_CHECKS_<SUBCOMMAND>_CHECKS_SETTINGS_FILE

Relative or fully qualified path to a configuration file for checks execution

Related links