View Source Installation

Add the hex package to mix.exs:

def deps do
  [
    {:ecto_date_time_range, "~> 0.1"}
  ]
end

migrations

Migrations

Add migrations using :tstzrange column types.

defmodule Core.Repo.Migrations.AddThings do
  use Ecto.Migration

  def change do
    create table(:things) do
      add :performed_during, :tstzrange
    end
  end
end

For more detailed inforamtion see the migrations guide.

schemas

Schemas

defmodule Core.Thing do
  use Ecto.Schema

  schema "things" do
    field :performed_during, Ecto.UTCDateTimeRange
  end
end