pub struct AddRelation {
pub from: String,
pub kind: RelationKind,
pub to: String,
pub via: String,
pub required: bool,
pub on_delete: OnDelete,
}Fields§
§from: String§kind: RelationKind§to: String§via: StringColumn or accessor name. For belongs_to, the FK column
(e.g. user_id). For has_many, the reverse accessor name on
the parent side (e.g. posts).
required: booltrue → NOT NULL FK column, requires a parent row to exist
before the child row can be inserted. false (default) → nullable,
safe to add to a table with existing rows.
0.9.0 default is false because upgrading a 0.8.0 project must
not break on pre-existing rows that pointed at id 0.
on_delete: OnDeleteThe SQL ON DELETE action when the referenced parent row is
removed. Default is Restrict: the parent row cannot be deleted
while any child references it. Cascade deletes the children.
SetNull nulls the FK on children (only valid when the column
is nullable — the executor will reject a SetNull + required
combination).
Trait Implementations§
Source§impl Clone for AddRelation
impl Clone for AddRelation
Source§fn clone(&self) -> AddRelation
fn clone(&self) -> AddRelation
Returns a duplicate of the value. Read more
1.0.0 · 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 AddRelation
impl Debug for AddRelation
Source§impl<'de> Deserialize<'de> for AddRelation
impl<'de> Deserialize<'de> for AddRelation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AddRelation
impl PartialEq for AddRelation
Source§impl Serialize for AddRelation
impl Serialize for AddRelation
impl StructuralPartialEq for AddRelation
Auto Trait Implementations§
impl Freeze for AddRelation
impl RefUnwindSafe for AddRelation
impl Send for AddRelation
impl Sync for AddRelation
impl Unpin for AddRelation
impl UnsafeUnpin for AddRelation
impl UnwindSafe for AddRelation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more