pub struct ForeignKey {
pub name: Option<Ident>,
pub columns: Vec<Ident>,
pub ref_table: Ident,
pub ref_columns: Vec<Ident>,
pub on_delete: Option<ForeignKeyAction>,
pub on_update: Option<ForeignKeyAction>,
}Expand description
A foreign-key constraint.
Fields§
§name: Option<Ident>The optional constraint name.
columns: Vec<Ident>The local columns.
ref_table: IdentThe referenced table.
ref_columns: Vec<Ident>The referenced columns.
on_delete: Option<ForeignKeyAction>The ON DELETE action.
on_update: Option<ForeignKeyAction>The ON UPDATE action.
Implementations§
Source§impl ForeignKey
impl ForeignKey
Sourcepub fn new<C: IntoIden, R: IntoIden>(
columns: impl IntoIterator<Item = C>,
ref_table: impl IntoIden,
ref_columns: impl IntoIterator<Item = R>,
) -> Self
pub fn new<C: IntoIden, R: IntoIden>( columns: impl IntoIterator<Item = C>, ref_table: impl IntoIden, ref_columns: impl IntoIterator<Item = R>, ) -> Self
Builds FOREIGN KEY (columns) REFERENCES table (ref_columns).
Sourcepub fn on_delete(self, action: ForeignKeyAction) -> Self
pub fn on_delete(self, action: ForeignKeyAction) -> Self
Sets ON DELETE action.
Sourcepub fn on_update(self, action: ForeignKeyAction) -> Self
pub fn on_update(self, action: ForeignKeyAction) -> Self
Sets ON UPDATE action.
Trait Implementations§
Source§impl Clone for ForeignKey
impl Clone for ForeignKey
Source§impl Debug for ForeignKey
impl Debug for ForeignKey
impl Eq for ForeignKey
Source§impl PartialEq for ForeignKey
impl PartialEq for ForeignKey
impl StructuralPartialEq for ForeignKey
Auto Trait Implementations§
impl Freeze for ForeignKey
impl RefUnwindSafe for ForeignKey
impl Send for ForeignKey
impl Sync for ForeignKey
impl Unpin for ForeignKey
impl UnsafeUnpin for ForeignKey
impl UnwindSafe for ForeignKey
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