When adding a primary key, it's possible to omit a specific
constraintName for the primary key. This is hazardous, because the database vendor will automatically name it for you in an unpredictable way, which makes things difficult later if you want to reference or remove it.
Also, you might already have a broad standard for object names - and be enforcing it with the object-name rule - but you might also want a more specific rule concerning how primary keys are named.
This rule will fail if there is no
constraintName given when adding a primary key, or when configured with a pattern, will fail if the given name does not match the pattern.
pattern- (regex, as string) optional regular expression that the name of any added primary key must adhere to
dynamicValue- (string) Spring EL expression, with the
AddPrimaryKeyChangeinstance as its expression scope, that should resolve to a string, and can then be interpolated in the pattern with
To simply ensure that a name is always given:
To ensure that a pattern is matched, including the table name: