pub struct ForeignKeyConstraint {
pub name: Option<String>,
pub columns: Vec<String>,
pub parent_table: String,
pub parent_columns: Vec<String>,
pub on_delete: FkAction,
pub on_update: FkAction,
pub match_type: MatchType,
pub deferrable: bool,
pub initially_deferred: bool,
}Expand description
v7.6.0 — A single FOREIGN KEY constraint. Both column-level
REFERENCES and table-level FOREIGN KEY (...) REFERENCES ...
parse into this shape — the column-level form has a single-entry
columns / parent_columns.
Fields§
§name: Option<String>Optional CONSTRAINT <name> prefix. Engine ignores the name
today but parses + stores it so a future ALTER TABLE DROP
CONSTRAINT can target by name (v7.6.8).
columns: Vec<String>Local columns participating in the FK (≥ 1).
parent_table: StringReferenced parent table.
parent_columns: Vec<String>Referenced parent columns. Must have the same arity as
columns; engine validates parent has a PK / UNIQUE index
on exactly this column set (v7.6.1).
on_delete: FkActionON DELETE action. Defaults to Restrict if absent.
on_update: FkActionON UPDATE action. Defaults to Restrict if absent.
match_type: MatchTypev7.38 (read01, T29) — MATCH {SIMPLE | FULL}. Defaults to Simple.
deferrable: boolv7.39 (round 288) — [NOT] DEFERRABLE. Parsed since v7.17 and
dropped on the floor, so a constraint declared DEFERRABLE was
enforced immediately and a circular-FK migration could not load.
initially_deferred: boolINITIALLY DEFERRED — the check moves to COMMIT unless
SET CONSTRAINTS … IMMEDIATE pulls it forward.
Trait Implementations§
Source§impl Clone for ForeignKeyConstraint
impl Clone for ForeignKeyConstraint
Source§fn clone(&self) -> ForeignKeyConstraint
fn clone(&self) -> ForeignKeyConstraint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more