Skip to content

Commit

Permalink
fix: correct update_one_without_selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-prisma committed Dec 20, 2024
1 parent 4318f68 commit 0a41f9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ pub(crate) async fn update_one_without_selection(
let id_args = pick_args(&model.primary_identifier().into(), &args);
// Perform the update and return the ids on which we've applied the update.
// Note: We are _not_ getting back the ids from the update. Either we got some ids passed from the parent operation or we perform a read _before_ doing the update.
let (_, ids) = update_many_from_ids_and_filter(conn, model, record_filter, args, None, ctx).await?;
let (updates, ids) = update_many_from_ids_and_filter(conn, model, record_filter, args, None, ctx).await?;
for update in updates {
conn.execute(update).await?;
}

// Since we could not get the ids back from the update, we need to apply in-memory transformation to the ids in case they were part of the update.
// This is critical to ensure the following operations can operate on the updated ids.
let merged_ids = merge_write_args(ids, id_args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,7 @@ pub(crate) async fn update_records_returning(
let meta = column_metadata::create(&field_names, &idents);
let mut records = ManyRecords::new(field_names.clone());

let updates = generate_updates(conn, model, record_filter, args, Some(&selected_fields.into()), ctx).await?;

for update in updates {
for update in generate_updates(conn, model, record_filter, args, Some(&selected_fields.into()), ctx).await? {
let result_set = conn.query(update).await?;

for result_row in result_set {
Expand Down

0 comments on commit 0a41f9b

Please sign in to comment.