Skip to content

Commit 13e9895

Browse files
authored
Remove redundant validate_attr case. (#5965)
- After change from this PR (https://github.com/phoenixframework/phoenix/pull/4601/files#diff-4307581434ae66da4750cde438c2b192c4a11c8b71ba32dbf78aea36daa0ee3eR368), `:enum` valid case becomes redundant. Next line has general check that includes valid enum case. - Also removed redundant passing throw for `:datetime` case. Instead, return already prepared result right away.
1 parent 6c4ef6e commit 13e9895

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/mix/phoenix/schema.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ defmodule Mix.Phoenix.Schema do
425425
mix phx.gen.schema Comment comments body:text status:enum:published:unpublished
426426
"""
427427

428-
defp validate_attr!({name, :datetime}), do: validate_attr!({name, :naive_datetime})
428+
defp validate_attr!({name, :datetime}), do: {name, :naive_datetime}
429429

430430
defp validate_attr!({name, :array}) do
431431
Mix.raise("""
@@ -438,7 +438,6 @@ defmodule Mix.Phoenix.Schema do
438438

439439
defp validate_attr!({_name, :enum}), do: Mix.raise(@enum_missing_value_error)
440440
defp validate_attr!({_name, type} = attr) when type in @valid_types, do: attr
441-
defp validate_attr!({_name, {:enum, _vals}} = attr), do: attr
442441
defp validate_attr!({_name, {type, _}} = attr) when type in @valid_types, do: attr
443442

444443
defp validate_attr!({_, type}) do

0 commit comments

Comments
 (0)