Fire AFTER ROW triggers for a DELETE operation. `old_fields` is the deleted row. Available as OLD.field in the trigger body.
(
state: &SharedState,
identity: &AuthenticatedIdentity,
tenant_id: TenantId,
collection: &str,
old_fields: &HashMap<String, nodedb_types::Value>,
cascade_depth: u32,
mode_
| 123 | /// |
| 124 | /// `old_fields` is the deleted row. Available as OLD.field in the trigger body. |
| 125 | pub async fn fire_after_delete( |
| 126 | state: &SharedState, |
| 127 | identity: &AuthenticatedIdentity, |
| 128 | tenant_id: TenantId, |
| 129 | collection: &str, |
| 130 | old_fields: &HashMap<String, nodedb_types::Value>, |
| 131 | cascade_depth: u32, |
| 132 | mode_filter: Option<TriggerExecutionMode>, |
| 133 | ) -> crate::Result<()> { |
| 134 | let triggers = |
| 135 | state |
| 136 | .trigger_registry |
| 137 | .get_matching(tenant_id.as_u64(), collection, DmlEvent::Delete); |
| 138 | |
| 139 | let after_triggers: Vec<_> = triggers |
| 140 | .into_iter() |
| 141 | .filter(|t| t.timing == TriggerTiming::After) |
| 142 | .filter(|t| mode_filter.is_none() || Some(t.execution_mode) == mode_filter) |
| 143 | .collect(); |
| 144 | |
| 145 | if after_triggers.is_empty() { |
| 146 | return Ok(()); |
| 147 | } |
| 148 | |
| 149 | check_cascade_depth(cascade_depth, collection)?; |
| 150 | |
| 151 | let bindings = RowBindings::after_delete(collection, old_fields.clone()); |
| 152 | |
| 153 | fire_triggers( |
| 154 | state, |
| 155 | identity, |
| 156 | tenant_id, |
| 157 | collection, |
| 158 | &after_triggers, |
| 159 | &bindings, |
| 160 | cascade_depth, |
| 161 | ) |
| 162 | .await |
| 163 | } |
| 164 | |
| 165 | /// Execute raw SQL in a trigger-like context (no row bindings). |
| 166 | /// |
no test coverage detected