28 lines
776 B
Plaintext
28 lines
776 B
Plaintext
![]() |
Sharing some naming conventions is a key factory in efficient team collaboration. This rule checks that all constraint names match a provided regular expression.
|
||
|
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
With <code>format_primary_key</code> set to "pk_[a-z]++ " and <code>format_foreign_key</code> to "fk_[a-z]++ ".
|
||
|
----
|
||
|
CREATE TABLE employee(
|
||
|
first_name VARCHAR2(42),
|
||
|
last_name VARCHAR2(42)
|
||
|
department_id INTEGER CONSTRAINT department_fk REFERENCES department,
|
||
|
CONSTRAINT fullname_pk PRIMARY KEY (first_name, last_name);
|
||
|
);
|
||
|
----
|
||
|
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
CREATE TABLE employee(
|
||
|
first_name VARCHAR2(42),
|
||
|
last_name VARCHAR2(42)
|
||
|
department_id INTEGER CONSTRAINT fk_department REFERENCES department,
|
||
|
CONSTRAINT pk_fullname PRIMARY KEY (first_name, last_name);
|
||
|
);
|
||
|
----
|
||
|
|