feat: add touch_update_defaults? option to bulk_create#2590
Merged
zachdaniel merged 3 commits intoash-project:mainfrom Feb 27, 2026
Merged
feat: add touch_update_defaults? option to bulk_create#2590zachdaniel merged 3 commits intoash-project:mainfrom
zachdaniel merged 3 commits intoash-project:mainfrom
Conversation
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.
mbaertschi
added a commit
to mbaertschi/ash_sqlite
that referenced
this pull request
Feb 25, 2026
…et context Read the touch_update_defaults? flag from the bulk_create options map rather than from changeset context. Depends on ash-project/ash#2590 which adds touch_update_defaults? to the options passed to data layers. Only merge once that PR is merged and released.
mbaertschi
added a commit
to mbaertschi/ash_postgres
that referenced
this pull request
Feb 25, 2026
…et context Read the touch_update_defaults? flag from the bulk_create options map rather than from changeset context. Depends on ash-project/ash#2590 which adds touch_update_defaults? to the options passed to data layers. Only merge once that PR is merged and released.
zachdaniel
reviewed
Feb 25, 2026
zachdaniel
reviewed
Feb 25, 2026
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.
Contributor
Author
|
hei @zachdaniel besides the two issues you mentioned, I also added this feature to the non-bulk upsert path. Do you agree? I have to backport this to the ash_postgres and ash_sqlite data layers as well |
Contributor
Author
|
ash-project/ash_sqlite#208 and ash-project/ash_postgres#701 now both respect the non-bulk path as well |
Contributor
|
I like the addition of the feature, but for non bulk I'd prefer it to be communicated via the changeset context. Adding an |
…d of data layer opts
zachdaniel
approved these changes
Feb 27, 2026
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Contributor checklist
Leave anything that you believe does not apply unchecked.