Skip to content

Commit

Permalink
fix: honor configured schema on bulk create
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 5, 2024
1 parent 6b24a78 commit 65180ec
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,13 @@ defmodule AshPostgres.DataLayer do
resource
end

opts =
if schema = Enum.at(changesets, 0).context[:data_layer][:schema] do
Keyword.put(opts, :prefix, schema)
else
opts
end

result =
with_savepoint(repo, opts[:on_conflict], fn ->
repo.insert_all(source, ecto_changesets, opts)
Expand Down

0 comments on commit 65180ec

Please sign in to comment.