Skip to content

Commit

Permalink
revert read no longer passing ids down the update
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Jul 31, 2023
1 parent 8bb5526 commit 5073e8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions query-engine/core/src/query_ast/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ impl UpdateRecord {
UpdateRecord::WithoutSelection(_) => None,
}
}

pub(crate) fn set_record_filter(&mut self, record_filter: RecordFilter) {
match self {
UpdateRecord::WithExplicitSelection(u) => u.record_filter = record_filter,
UpdateRecord::WithImplicitSelection(u) => u.record_filter = record_filter,
UpdateRecord::WithoutSelection(u) => u.record_filter = record_filter,
}
}
}

#[derive(Debug, Clone)]
Expand Down
15 changes: 14 additions & 1 deletion query-engine/core/src/query_graph_builder/write/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ pub(crate) fn update_record(

utils::insert_emulated_on_update(graph, query_schema, &model, &read_parent_node, &update_node)?;

graph.create_edge(&read_parent_node, &update_node, QueryGraphDependency::ExecutionOrder)?;
graph.create_edge(
&read_parent_node,
&update_node,
QueryGraphDependency::ProjectedDataDependency(
model.primary_identifier(),
Box::new(move |mut update_node, parent_ids| {
if let Node::Query(Query::Write(WriteQuery::UpdateRecord(ref mut ur))) = update_node {
ur.set_record_filter(parent_ids.into());
}

Ok(update_node)
}),
),
)?;
}

// If the update can be done in a single operation (which includes getting the result back),
Expand Down

0 comments on commit 5073e8a

Please sign in to comment.