ON_UPDATE

Constant ON_UPDATE 

Source
pub const ON_UPDATE: ColumnMarker;
Expand description

Specifies the ON UPDATE action for foreign key references.

§Example

#[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: Similar to RESTRICT (default)

See: https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK