mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
chore: rewrite keys properly
This commit is contained in:
parent
4a69edce2d
commit
a563786218
1 changed files with 11 additions and 0 deletions
|
@ -2303,6 +2303,11 @@ defmodule AshPostgres.MigrationGenerator do
|
||||||
|
|
||||||
references ->
|
references ->
|
||||||
references
|
references
|
||||||
|
|> rewrite(
|
||||||
|
destination_field: :destination_attribute,
|
||||||
|
destination_field_default: :destination_attribute_default,
|
||||||
|
destination_field_generated: :destination_attribute_generated
|
||||||
|
)
|
||||||
|> Map.delete(:ignore)
|
|> Map.delete(:ignore)
|
||||||
|> rewrite(:ignore?, :ignore)
|
|> rewrite(:ignore?, :ignore)
|
||||||
|> Map.update!(:destination_attribute, &String.to_atom/1)
|
|> Map.update!(:destination_attribute, &String.to_atom/1)
|
||||||
|
@ -2327,6 +2332,12 @@ defmodule AshPostgres.MigrationGenerator do
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp rewrite(map, keys) do
|
||||||
|
Enum.reduce(map, fn {key, to} ->
|
||||||
|
rewrite(map, key, to)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
defp rewrite(map, key, to) do
|
defp rewrite(map, key, to) do
|
||||||
if Map.has_key?(map, key) do
|
if Map.has_key?(map, key) do
|
||||||
map
|
map
|
||||||
|
|
Loading…
Reference in a new issue