Skip to content

refactor: read touch_update_defaults? from options instead of changeset context#208

Open
mbaertschi wants to merge 5 commits intoash-project:mainfrom
mbaertschi:refactor/bulk_upsert_updated_at
Open

refactor: read touch_update_defaults? from options instead of changeset context#208
mbaertschi wants to merge 5 commits intoash-project:mainfrom
mbaertschi:refactor/bulk_upsert_updated_at

Conversation

@mbaertschi
Copy link
Contributor

@mbaertschi mbaertschi commented Feb 25, 2026

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.

Also support touch_update_defaults? option in non-bulk upsert path

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

Ports ash-project/ash_postgres#697 to ash_sqlite. update_timestamp
attributes (e.g. updated_at) were never included in the ON CONFLICT
DO UPDATE SET clause because they have writable?: false. Now fields
with update_defaults are always included when an upsert modifies
fields. Can be disabled via context:
%{data_layer: %{touch_update_defaults?: false}}
…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
Copy link
Contributor Author

@zachdaniel tests will pass once ash-project/ash#2590 is merged into ash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant