#[non_exhaustive]pub enum ReferenceAction {
Cascade,
Restrict,
SetNull,
SetDefault,
NoAction,
}Expand description
The referential action taken on child rows when the referenced parent row changes.
Used in ForeignKeyDef::on_delete and ForeignKeyDef::on_update to control cascading
behaviour. In JSON model files these are written in snake_case
(e.g. "on_delete": "cascade").
This enum is #[non_exhaustive]: new variants may be added in future releases.
Downstream match expressions should include a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Cascade
Automatically delete or update child rows when the parent row is deleted or updated (CASCADE).
Restrict
Prevent the parent row from being deleted or updated if child rows exist (RESTRICT).
SetNull
Set the foreign key column(s) in child rows to NULL when the parent changes (SET NULL).
The column must be nullable.
SetDefault
Set the foreign key column(s) in child rows to their column default when the parent changes (SET DEFAULT).
NoAction
Do nothing to child rows; the database defers enforcement or raises an error (NO ACTION).
Implementations§
Source§impl ReferenceAction
impl ReferenceAction
Sourcepub fn to_sql_keyword(&self) -> &'static str
pub fn to_sql_keyword(&self) -> &'static str
SQL keyword representation as written in ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY ... ON DELETE <keyword> etc. Used by
vespertide-query when emitting raw SQL (e.g. the F11
NOT VALID + VALIDATE PG path, which bypasses the sea-query
ForeignKey builder).
Trait Implementations§
Source§impl Clone for ReferenceAction
impl Clone for ReferenceAction
Source§fn clone(&self) -> ReferenceAction
fn clone(&self) -> ReferenceAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReferenceAction
impl Debug for ReferenceAction
Source§impl<'de> Deserialize<'de> for ReferenceAction
impl<'de> Deserialize<'de> for ReferenceAction
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>,
impl Eq for ReferenceAction
Source§impl JsonSchema for ReferenceAction
impl JsonSchema for ReferenceAction
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for ReferenceAction
impl Ord for ReferenceAction
Source§fn cmp(&self, other: &ReferenceAction) -> Ordering
fn cmp(&self, other: &ReferenceAction) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ReferenceAction
impl PartialEq for ReferenceAction
Source§fn eq(&self, other: &ReferenceAction) -> bool
fn eq(&self, other: &ReferenceAction) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ReferenceAction
impl PartialOrd for ReferenceAction
Source§impl Serialize for ReferenceAction
impl Serialize for ReferenceAction
impl StructuralPartialEq for ReferenceAction
Auto Trait Implementations§
impl Freeze for ReferenceAction
impl RefUnwindSafe for ReferenceAction
impl Send for ReferenceAction
impl Sync for ReferenceAction
impl Unpin for ReferenceAction
impl UnsafeUnpin for ReferenceAction
impl UnwindSafe for ReferenceAction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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>
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