As I’ve mentioned before I’m currently working on a project that has some gnarly deprecation issues. Being new to Elixir (and development in general) it is proving to be a great learning opportunity but I am very stuck on something.
I have a model like:
schema "person" do field :date_of_birth, Ecto.Date field :appointment_time, Ecto.Time timestamps() @required_fields ~w(appointment_time) @optional_fields ~w(date_of_birth) def changeset(model, params \\ :empty) do model |> cast(params, @required_fields, @optional_fields) end
date_of_birth goes to a
date column in the DB and
appointment_time to a
appointment_time's associated param is a string formatted like “00:00:00”.
I am utterly confused about how to replace these types properly after their deprecations. My current implementation as per my understanding of the docs:
field :date_of_birth, :date field :appointment_time, :utc_datetime
This is clearly incorrect because the
appointment_time fails the
cast type validation. I have many examples of this particular requirement throughout the project so I’d really like to understand the correct methodology at play.