We currently have these policies defined
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default)] |
|
pub enum ForeignKeyOnDeletePolicy { |
|
/// Don't do any additional actions on delete. |
|
NoAction, |
|
/// Prevent the delete if this model instance is referenced by another row. |
|
#[default] |
|
Restrict, |
|
/// Remove the referencing row if the referenced row is deleted. |
|
Cascade, |
|
/// Set the foreign key in the referencing row to [`None`]. |
|
SetNone, |
|
} |
and
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default)] |
|
pub enum ForeignKeyOnUpdatePolicy { |
|
/// Don't do any additional actions on update. |
|
NoAction, |
|
/// Prevent the update if this model instance is referenced by another row. |
|
Restrict, |
|
/// Update the foreign key in the referencing row if the referenced row is |
|
/// updated. |
|
#[default] |
|
Cascade, |
|
/// Set the foreign key in the referencing row to [`None`]. |
|
SetNone, |
|
} |
However, we need to be able to expose them. Perhaps to use them like this:
#[model]
struct Foo {
#[model(foreign_key(on_delete="cascade", on_update="set_none"))]
bar: ForeignKey<Bar>
}
We currently have these policies defined
cot/cot/src/db/relations.rs
Lines 143 to 154 in 4620c6a
cot/cot/src/db/relations.rs
Lines 175 to 187 in 4620c6a
However, we need to be able to expose them. Perhaps to use them like this: