You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add touch_update_defaults? option to bulk_create (#2590)
Allows callers to skip updating update_default fields (like updated_at)
when a bulk_create upsert results in an update. Supported in ETS and
Mnesia data layers.
- respect explicitly set update_default fields in upsert
When touch_update_defaults? is false, update_default fields that were
explicitly included in upsert_fields or set by the user on the changeset
are now preserved instead of being stripped. Also wires touch_update_defaults?
through Ash.create! for non-bulk upserts via a new upsert/5 data layer callback.
- communicate touch_update_defaults? via changeset context instead of data layer opts
Copy file name to clipboardExpand all lines: lib/ash.ex
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -365,6 +365,12 @@ defmodule Ash do
365
365
type: :any,
366
366
doc:
367
367
"An expression to check if the record should be updated when there's a conflict."
368
+
],
369
+
touch_update_defaults?: [
370
+
type: :boolean,
371
+
default: true,
372
+
doc:
373
+
"Whether or not to apply update defaults (like `updated_at` timestamps) on upsert. Only relevant when `upsert?: true` is set. Set to `false` to skip touching update_default fields when an upsert results in an update."
"An expression to check if the record should be updated when there's a conflict."
688
+
],
689
+
touch_update_defaults?: [
690
+
type: :boolean,
691
+
default: true,
692
+
doc:
693
+
"Whether or not to apply update defaults (like `updated_at` timestamps) on upsert. Only relevant when `upsert?: true` is set. Set to `false` to skip touching update_default fields when an upsert results in an update."
0 commit comments