Multiple Objects Quality Check

The multiple objects quality check lets you verify whether objects in your database adhere to naming conventions you specify. You can use it to test multiple types of objects at the same time, rather than creating individual checks for each one.

The name of the multiple objects check depends on what kind of search you want to make:

  • --check-name=ObjectNameMustMatch specifies a positive search
  • --check-name=ObjectNameMustNotMatch specifies a negative search

Liquibase supports this check on the following objects:

  • TABLE
  • COLUMN
  • SEQUENCE

Using the multiple objects check

You can create a new multiple objects check with the following command:

liquibase checks copy --check-name=[ObjectNameMustMatch|ObjectNameMustNotMatch]

Liquibase then asks how you want to configure the check attributes. Here is an example of the configuration prompts in the CLI:

Give your check a short name for easier identification (up to 64 alpha-numeric characters only) [ObjectNameMustMatch1]:
New check 'ObjectNameMustMatch1' created from 'ObjectNameMustMatch'
Set the Severity to return a code of 0-4 when triggered. (options: 'INFO'|0, 'MINOR'|1, 'MAJOR'|2, 'CRITICAL'|3, 'BLOCKER'|4 )? [INFO]:
Set 'OPERATOR' (options: STARTS_WITH, ENDS_WITH, CONTAINS, REGEXP)  [STARTS_WITH]:
Set 'SEARCH_STRING' (options: a string, or a valid regular expression) : helloworld
Set 'OBJECT_TYPES' to check, separated by commas (options: TABLE, COLUMN, SEQUENCE) : table,column
Set 'CASE_SENSITIVE' (options: true, false)  [true]:

To edit your check later, run the liquibase checks customize command. To validate your changelog with the multiple objects check, run the following command:

liquibase checks run

Multiple objects check attributes

Parameter Type Description Customization Default
OPERATOR String/enum

The location to look for the provided SEARCH_STRING value

  • STARTS_WITH – Value of SEARCH_STRING should be found at the beginning of the table.
  • ENDS_WITH – Value of SEARCH_STRING should be found at the end of the table.
  • CONTAINS – Value of SEARCH_STRING can be anywhere in the table.
  • REGEXP – Value of SEARCH_STRING is a regexp that should be matched.

STARTS_WITH

SEARCH_STRING String/enum

The substring or regular expression to match with the one in the changelog file. Cannot be empty.

When OPERATOR=REGEXP, SEARCH_STRING must be a valid regular expression. Otherwise, all characters are allowed

None
CASE_SENSITIVE String/enum Set how the SearchString is processed

User entry of true or false is accepted case-insensitively

When operator=REGEXP, CASE_SENSITIVE prompt is not shown

true

Note: Liquibase uses the java.util.regex engine to match regular expressions.

Related links