Skip to content

Commit

Permalink
Take enum values from on_dump
Browse files Browse the repository at this point in the history
  • Loading branch information
fuelen committed Feb 17, 2022
1 parent 73b1ba2 commit e3705e0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/ecto/erd/dot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,8 @@ defmodule Ecto.ERD.Dot do

defp format_field(%Field{name: name}, :name), do: inspect(name)

defp format_field(%Field{type: {:parameterized, Ecto.Enum, %{values: values}}}, :type) do
"#Enum<#{inspect(values)}>"
end

defp format_field(%Field{type: {:parameterized, Ecto.Enum, %{mappings: mappings}}}, :type) do
keys = mappings |> Enum.into(%{}) |> Map.keys()

"#Enum<#{inspect(keys)}>"
defp format_field(%Field{type: {:parameterized, Ecto.Enum, %{on_dump: on_dump}}}, :type) do
"#Enum<#{inspect(Map.keys(on_dump))}>"
end

defp format_field(
Expand Down

0 comments on commit e3705e0

Please sign in to comment.