Skip to content

Commit 1e923a1

Browse files
committed
Improve error message on invalid migration type, closes #319
1 parent 018ba1b commit 1e923a1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/ecto/migration.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,21 @@ defmodule Ecto.Migration do
12311231
reference
12321232
end
12331233

1234+
defp validate_type!(type) do
1235+
raise ArgumentError, """
1236+
invalid migration type: #{inspect(type)}. Expected one of:
1237+
1238+
* an atom, such as :string
1239+
* a quoted atom, such as :"integer unsigned"
1240+
* an Ecto.Type, such as Ecto.UUID
1241+
* a tuple of the above, such as {:array, :integer} or {:array, Ecto.UUID}
1242+
* a reference, such as references(:users)
1243+
1244+
All Ecto types are allowed and properly translated.
1245+
All other types are sent to the database as is.
1246+
"""
1247+
end
1248+
12341249
defp validate_index_opts!(opts) when is_list(opts) do
12351250
case Keyword.get_values(opts, :where) do
12361251
[_, _ | _] ->

0 commit comments

Comments
 (0)