pub struct ForeignKeyMeta {
pub name: Option<Cow<'static, str>>,
pub columns: Vec<Cow<'static, str>>,
pub referenced_table: Cow<'static, str>,
pub referenced_columns: Vec<Cow<'static, str>>,
pub on_delete: Option<Cow<'static, str>>,
}Expand description
A foreign key declared on an entity.
Single-column keys are usually inferred from BelongsTo navigations or the
scalar #[foreign_key(Target)] attribute; composite keys are declared via
crate::model_builder::EntityTypeBuilder::has_foreign_key.
Fields§
§name: Option<Cow<'static, str>>Explicit constraint name. None → derived from table + columns.
columns: Vec<Cow<'static, str>>Dependent columns (on this entity’s table), in order.
referenced_table: Cow<'static, str>Principal table name.
referenced_columns: Vec<Cow<'static, str>>Principal columns, in order (same arity as columns).
on_delete: Option<Cow<'static, str>>Optional ON DELETE SQL clause (e.g. "CASCADE").
Implementations§
Source§impl ForeignKeyMeta
impl ForeignKeyMeta
Sourcepub fn derive_name(&self, table: &str) -> String
pub fn derive_name(&self, table: &str) -> String
Derives the default constraint name for table.
Trait Implementations§
Source§impl Clone for ForeignKeyMeta
impl Clone for ForeignKeyMeta
Source§impl Debug for ForeignKeyMeta
impl Debug for ForeignKeyMeta
impl Eq for ForeignKeyMeta
Source§impl PartialEq for ForeignKeyMeta
impl PartialEq for ForeignKeyMeta
impl StructuralPartialEq for ForeignKeyMeta
Auto Trait Implementations§
impl Forget for ForeignKeyMeta
impl Freeze for ForeignKeyMeta
impl Move for ForeignKeyMeta
impl RefUnwindSafe for ForeignKeyMeta
impl Send for ForeignKeyMeta
impl Sync for ForeignKeyMeta
impl Unpin for ForeignKeyMeta
impl UnsafeUnpin for ForeignKeyMeta
impl UnwindSafe for ForeignKeyMeta
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