mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
fix: fix upserting update_defaults
This commit is contained in:
parent
98418599f9
commit
cdca33a5ff
1 changed files with 12 additions and 0 deletions
|
@ -1325,6 +1325,18 @@ defmodule AshPostgres.DataLayer do
|
|||
attributes
|
||||
|> Enum.filter(&(!&1.match_other_defaults? && get_default_fun(&1)))
|
||||
|> Enum.map(&{&1.name, &1.update_default})
|
||||
|> Enum.flat_map(fn {name, default_fun} ->
|
||||
default_value =
|
||||
case default_fun do
|
||||
function when is_function(function) ->
|
||||
function.()
|
||||
|
||||
{m, f, a} when is_atom(m) and is_atom(f) and is_list(a) ->
|
||||
apply(m, f, a)
|
||||
end
|
||||
|
||||
{name, default_value}
|
||||
end)
|
||||
end
|
||||
|
||||
defp lazy_matching_defaults(attributes) do
|
||||
|
|
Loading…
Reference in a new issue