Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/migration_generator/migration_generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ defmodule AshPostgres.MigrationGenerator do

defp format(string, opts) do
if opts.format do
Code.format_string!(string)
Code.format_string!(string, locals_without_parens: ecto_sql_locals_without_parens())
else
string
end
Expand All @@ -526,6 +526,17 @@ defmodule AshPostgres.MigrationGenerator do
reraise exception, __STACKTRACE__
end

defp ecto_sql_locals_without_parens do
path = File.cwd!() |> Path.join("deps/ecto_sql/.formatter.exs")

if File.exists?(path) do
{opts, _} = Code.eval_file(path)
Keyword.get(opts, :locals_without_parens, [])
else
[]
end
end

defp streamline(ops, acc \\ [])
defp streamline([], acc), do: Enum.reverse(acc)

Expand Down