Skip to content

Commit

Permalink
Soft deprecate :datetime for modify in migrations
Browse files Browse the repository at this point in the history
Fixes the other part of elixir-ecto#1870
  • Loading branch information
michalmuskala committed Jan 4, 2017
1 parent 85e242b commit 8d2c608
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/ecto/migration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,15 @@ defmodule Ecto.Migration do
* `:precision` - the precision for a numeric type. Default is no precision.
* `:scale` - the scale of a numeric type. Default is 0 scale.
"""
def modify(column, type, opts \\ []) when is_atom(column) do
def modify(column, type, opts \\ [])

def modify(column, :datetime, opts) when is_atom(column) do
IO.warn "the :datetime type in migrations is deprecated, " <>
"please use :utc_datetime or :naive_datetime instead"
modify(column, :naive_datetime, opts)
end

def modify(column, type, opts) when is_atom(column) do
Runner.subcommand {:modify, column, type, opts}
end

Expand Down

0 comments on commit 8d2c608

Please sign in to comment.