rspec/rules/S1615/rule.adoc

29 lines
767 B
Plaintext
Raw Normal View History

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.
== Noncompliant Code Example
2021-01-27 13:42:22 +01:00
With ``++format_primary_key++`` set to "pk_[a-z]++ " and ``++format_foreign_key++`` to "fk_[a-z]++ ".
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);
);
----
== 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);
);
----