bitwalker / timex_ecto

An adapter for using Timex DateTimes with Ecto
MIT License
162 stars 68 forks source link

invalid or unknown type Timex.Ecto.TimestampWithTimezone #68

Closed lauraannwilliams closed 6 years ago

lauraannwilliams commented 6 years ago

I'm getting this error when I try to use as a field type Timex.Ecto.TimestampWithTimezone. The use Timex.Ecto.Timestamps feature is working correctly.

I assume I'm doing something wrong, but I can't find any clues in the documentation. I'd appreciate any pointers to get past this, thank you.

Details follow.

Code

  use Ecto.Schema
  use Timex.Ecto.Timestamps

  schema "users" do
    field :display_name, :string
    field :last_sign_in, Timex.Ecto.TimestampWithTimezone
  end

Stacktrace:

Compilation error on file lib/app/auth/schema/user.ex ==
** (ArgumentError) invalid or unknown type Timex.Ecto.TimestampWithTimezone for field :last_sign_in
    lib/ecto/schema.ex:1727: Ecto.Schema.check_type!/3
    lib/ecto/schema.ex:1431: Ecto.Schema.__field__/4
    lib/ethelo/auth/schema/user.ex:19: (module)
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

Versions: timex 3.1.24 timex_ecto 3.1.1 ecto 2.1.6

bitwalker commented 6 years ago

You need to use 3.2.0+ of timex_ecto to use that type, as it was added only recently.

lauraannwilliams commented 6 years ago

That would be the obvious thing I was missing. Thanks! I'll watch for 3.2.0 to be released.

bitwalker commented 6 years ago

I'll try and get it released tomorrow, it should be tagged in git if you want to experiment with it early.