2023-05-03 11:06:20 +02:00
== Why is this an issue?
2020-06-30 12:47:33 +02:00
Sharing some naming conventions is a key factory in efficient team collaboration. This rule checks that all constraint names match a provided regular expression.
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2021-01-27 16:55:38 +01:00
With ``++format_primary_key++`` set to "pk_[a-z]{plus}{plus} " and ``++format_foreign_key++`` to "fk_[a-z]{plus}{plus} ".
2020-06-30 14:49:38 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:47:33 +02:00
----
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);
);
----
2023-05-03 11:06:20 +02:00
=== Compliant solution
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:47:33 +02:00
----
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);
);
----