rspec/rules/S1615/rule.adoc

33 lines
843 B
Plaintext

== Why is this an issue?
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 ``++format_primary_key++`` set to "pk_[a-z]{plus}{plus} " and ``++format_foreign_key++`` to "fk_[a-z]{plus}{plus} ".
[source,text]
----
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
[source,text]
----
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);
);
----