Simple question, how to add a default Ecto.Date value to a field without using timestamp?
alter table(:registro) do
modify :data, :date, [null: false, default: Ecto.Date.utc()]
end
I know that this isnt the right way to do, but the exception still bugs me
(ArgumentError) unknown default #Ecto.Date<2017-03-21> for type :date. :default may be a string, number, boolean, empty list or a fragment(…)
should work, although you are using a date field, so I’m not 100% - you might need to use: modify :data, :date, [null: false, default: fragment("current_date")]