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,
}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.
Trait Implementations§
Source§impl Clone for ForeignKeyConstraint
impl Clone for ForeignKeyConstraint
Source§fn clone(&self) -> ForeignKeyConstraint
fn clone(&self) -> ForeignKeyConstraint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ForeignKeyConstraint
impl Debug for ForeignKeyConstraint
Source§impl Display for ForeignKeyConstraint
impl Display for ForeignKeyConstraint
Source§impl PartialEq for ForeignKeyConstraint
impl PartialEq for ForeignKeyConstraint
Source§fn eq(&self, other: &ForeignKeyConstraint) -> bool
fn eq(&self, other: &ForeignKeyConstraint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ForeignKeyConstraint
Auto Trait Implementations§
impl Freeze for ForeignKeyConstraint
impl RefUnwindSafe for ForeignKeyConstraint
impl Send for ForeignKeyConstraint
impl Sync for ForeignKeyConstraint
impl Unpin for ForeignKeyConstraint
impl UnsafeUnpin for ForeignKeyConstraint
impl UnwindSafe for ForeignKeyConstraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more