Skip to main content

code_from_constraint

Function code_from_constraint 

Source
pub fn code_from_constraint(constraint: &str) -> String
Expand description

The rule code a database constraint stands for.

Generated constraints are named ck_<table>__<code> (CHECK), uq_<table>__<code> (unique index), ex_<table>__<code> (exclusion) and tg_<table>__<code> (constraint trigger), so a violation the database raises maps back to the code of the rule it enforces. A constraint named otherwise is its own code: hand-written triggers raise with a constraint name chosen to be read (fiscal_period_status_transition).