fix: ensure index keys are atoms in generated migrations

This commit is contained in:
Emad Shaaban 2024-06-18 18:22:55 +03:00 committed by Zach Daniel
parent 1af3f7d273
commit aa40778cc4
2 changed files with 2 additions and 2 deletions

View file

@ -3266,7 +3266,7 @@ defmodule AshPostgres.MigrationGenerator do
:keys,
&Enum.map(&1, fn
["sql", value] when is_binary(value) -> {:sql, value}
key -> maybe_to_atom(key)
key -> key
end)
)
end

View file

@ -31,7 +31,7 @@ defmodule AshPostgres.MigrationGenerator.Operation do
def as_atom(value), do: Macro.inspect_atom(:remote_call, String.to_atom(value))
def index_key({:sql, value}) when is_binary(value), do: inspect(value)
def index_key(value) when is_binary(value) or is_atom(value), do: inspect(value)
def index_key(value) when is_binary(value) or is_atom(value), do: ":#{as_atom(value)}"
def option(key, value) when key in [:nulls_distinct, "nulls_distinct"] do
if !value do