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]:

You can edit your check later with 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 Options/Validation Default
Operator String/enum The location to look for the provided SearchString value

Options:

startsWith: SearchString provided is at the beginning of the label

endsWith: SearchString provided is at the end of the label

contains: SearchString provided can be anywhere in the label

regexp: SearchString provided is a regular expression

startsWith
SearchString String The substring or regular expression to match. Cannot be empty

Validation:

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

None
CaseSensitive String Set how the SearchString is processed

Options:

true: SearchString is case-sensitive

false: SearchString is not case-sensitive

Validation:

When operator=REGEXP, CaseSensitive prompt is not shown

true

Multiple checks example output

+-----+--------------------------------+----------------------------+--------------------------------+---------+--------------------------------+----------+
| #   | Check Name                     | Short Name                 | Description                    | Enabled | Customization                  | Severity |
+-----+--------------------------------+----------------------------+--------------------------------+---------+--------------------------------+----------+
| 80  | Object name pattern match      | ObjectNameMustMatch1       | This check confirms the listed | true    | OPERATOR = STARTS_WITH         | 0        |
|     |                                |                            | object names conform to the    |         | SEARCH_STRING = helloworld     |          |
|     |                                |                            | supplied pattern               |         | OBJECT_TYPES = TABLE,COLUMN    |          |
|     |                                |                            |                                |         | CASE_SENSITIVE = true          |          |
+-----+--------------------------------+----------------------------+--------------------------------+---------+--------------------------------+----------+

Related links