Ensure edge record deletes do not cascade to related records

Closes #1817
This commit is contained in:
Tobie Morgan Hitchcock 2023-04-16 18:17:44 +01:00
parent 7413e93a48
commit 50c3554242
2 changed files with 6 additions and 1 deletions

View file

@ -45,6 +45,7 @@ impl<'a> Document<'a> {
fd if fd.is_id() => continue,
fd if fd.is_in() => continue,
fd if fd.is_out() => continue,
fd if fd.is_meta() => continue,
fd => self.current.to_mut().del(ctx, opt, txn, fd).await?,
}
}

View file

@ -7,7 +7,7 @@ use crate::sql::error::IResult;
use crate::sql::fmt::{fmt_separated_by, Fmt};
use crate::sql::part::Next;
use crate::sql::part::{all, field, first, graph, index, last, part, value, Part};
use crate::sql::paths::{ID, IN, OUT};
use crate::sql::paths::{ID, IN, META, OUT};
use crate::sql::serde::is_internal_serialization;
use crate::sql::value::Value;
use md5::Digest;
@ -108,6 +108,10 @@ impl Idiom {
pub(crate) fn is_out(&self) -> bool {
self.0.len() == 1 && self.0[0].eq(&OUT[0])
}
/// Check if this expression is an 'out' field
pub(crate) fn is_meta(&self) -> bool {
self.0.len() == 1 && self.0[0].eq(&META[0])
}
/// Check if this is an expression with multiple yields
pub(crate) fn is_multi_yield(&self) -> bool {
self.iter().any(Self::split_multi_yield)