Skip to main content

ON_UPDATE

Constant ON_UPDATE 

Source
pub const ON_UPDATE: ColumnMarker;
Expand description

Sets the ON UPDATE action of a foreign key.

§Examples

#[column(references = User::id, on_update = CASCADE)]
user_id: i32,

§Supported Actions

  • CASCADE: Update referencing rows when referenced row is updated
  • SET_NULL: Set the column to NULL when referenced row is updated
  • SET_DEFAULT: Set the column to its default value
  • RESTRICT: Prevent update if referenced
  • NO_ACTION: Like RESTRICT, but checked at the end of the statement (the default)

See: https://sqlite.org/foreignkeys.html#fk_actions