You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Database check to find tables that do not have a Primary Key AND do not contain "NPK" in their name.
This check uses Check Chaining which requires Liquibase Pro 4.27.0+.
Sample Passing Tables
CREATETABLE `tablenpk` (
`id`int(11) NOT NULL,
`name`varchar(50) NOT NULL
);
CREATETABLE `tablewithpk` (
`id`int(11) NOT NULL,
`name`varchar(50) NOT NULL,
PRIMARY KEY (`id`)
);
Sample Failing Table
CREATETABLE `tablewithoutpk` (
`id`int(11) NOT NULL,
`name`varchar(50) NOT NULL
);
Sample Error Message
DATABASE CHECKS
----------------
Validation of the database snapshot found the following issues:
Check Name: Chained checks template (TablesWithoutPKNamingStandard)
Object Type: table
Object Name: tablewithoutpk
Object Location: horses.horses.tablewithoutpk
Check Severity: MAJOR (Return code: 2)
Message: Tables without primary keys must have npk in the table name
Give your check a short name for easier identification (up to 64 alpha-numeric characters only) [ChainedChecksTemplate1]:
TablesWithoutPKNamingStandard
Set the Severity to return a code of 0-4 when triggered. (options: 'INFO'=0, 'MINOR'=1, 'MAJOR'=2, 'CRITICAL'=3, 'BLOCKER'=4)? [INFO]:
<Choose a value: 0, 1, 2, 3, 4>
Enter the shortname, logic conditional (using &&, ||, !), and optional (groupings) for your checks. Example: "(shortname1 && shortname2) || shortname3":
TablesMustHavePK && TablenameContainsNPK
Set 'MESSAGE' [A match for regular expression <SEARCH_STRING> was detected in Changeset .]:
Tables without primary keys must have npk in the table name