checks copy command

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

Uses

If you want to run the same check with different values, use checks 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 see the list of available checks, run liquibase checks show.

Running the checks copy command

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

  1. Run the command specifying your values:

    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.

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

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

checks copy command attributes

Name Syntax Description
checks-settings-file

CLI:

--checks-settings-file

Property:

liquibase.command.checks.<subcommand>.checksSettingsFile

Environment Variable:

LIQUIBASE_COMMAND_CHECKS_<subcommand>_CHECKS_SETTINGS_FILE

The parameter which specifies the needed checks settings file to work with subcommands.

Set the checks-settings-file parameter to the relative path of the checks-settings-file that you want to read from or modify.

For more information, see checks settings file.

check-name

CLI:

--check-name

Property:

liquibase.command.checks.<subcommand>.checkName

Environment Variable:

LIQUIBASE_COMMAND_CHECKS_<subcommand>_CHECK_NAME

The parameter which you must specify so that any of the following subcommands being executed can perform its function:

  • copy
  • customize
  • delete
  • disable
  • enable
  • reset

Set the check-name parameter to the short name for the check you want to target with one of the subcommands.

Related links