`bulk_create` requiring `upsert_fields` with `upsert?: true`

Small conflict between the docs and usage of bulk_create: Docs: "If not set, the action's upsert_fields is used, and if that is not set, then any fields not being set to defaults are written." https://hexdocs.pm/ash/Ash.Api.html#c:bulk_create/4 The error:
** (ArgumentError) For bulk actions, `upsert_fields` must be specified if upsert? is set to true`
** (ArgumentError) For bulk actions, `upsert_fields` must be specified if upsert? is set to true`
6 Replies
\ ឵឵឵
\ ឵឵឵OP2y ago
GitHub
ash/bulk.ex at c174713b70798e465838e77420fb51b70f36ea67 · ash-proje...
A declarative and extensible framework for building Elixir applications. - ash/bulk.ex at c174713b70798e465838e77420fb51b70f36ea67 · ash-project/ash
ZachDaniel
ZachDaniel2y ago
Thanks for the report! Mind opening an issue on the repo? I’ll get it changed. A PR to the docs would also be great 🙂
\ ឵឵឵
\ ឵឵឵OP2y ago
I can PR the docs, but it's there something in the way of us adding the requisite behavior? Haven't had time to dig.
ZachDaniel
ZachDaniel2y ago
Nope, it’s a mistake copying from the create action. I don’t think that we can currently support that behavior with bulk upserts.
\ ឵឵឵
\ ឵឵឵OP2y ago
GitHub
docs: bulk_create does not support automatic upsert_fields by b...
Contributor checklist Bug fixes include regression tests Chores Documentation changes Features include unit/acceptance tests Refactoring Update dependencies
\ ឵឵឵
\ ឵឵឵OP2y ago
Not gonna pass CI with the credo/unit stuff

Did you find this page helpful?