Skip to content

fix: bulk_create with upsert now updates update_timestamp fields#207

Merged
zachdaniel merged 1 commit intoash-project:mainfrom
mbaertschi:fix/bulk_upsert_updated_at
Feb 25, 2026
Merged

fix: bulk_create with upsert now updates update_timestamp fields#207
zachdaniel merged 1 commit intoash-project:mainfrom
mbaertschi:fix/bulk_upsert_updated_at

Conversation

@mbaertschi
Copy link
Contributor

@mbaertschi mbaertschi commented Feb 25, 2026

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}}

closes #206

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}}
@mbaertschi
Copy link
Contributor Author

@zachdaniel I ran mix check and also fixed formatter and credo.. If you don't like this, I'll undo those changes

@zachdaniel
Copy link
Contributor

@mbaertschi thank you 🙇

@zachdaniel zachdaniel merged commit 21dd0b2 into ash-project:main Feb 25, 2026
6 checks passed
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.

bulk_create with upsert does not update update_timestamp fields

2 participants