fix: properly upsert on non batchable rows

This commit is contained in:
Zach Daniel 2023-05-25 11:34:13 -04:00
parent f3d201a211
commit d2b54fdda9

View file

@ -809,8 +809,16 @@ defmodule Ash.Actions.Create.Bulk do
})
else
[changeset] = batch
upsert? = opts[:upsert?] || action.upsert? || false
case Ash.DataLayer.create(resource, changeset) do
result =
if upsert? do
Ash.DataLayer.upsert(resource, changeset, upsert_keys)
else
Ash.DataLayer.create(resource, changeset)
end
case result do
{:ok, result} ->
{:ok,
[