View Source Migrations
Ecto.UTCDateTime
ranges can be indicated in migrations with the :tstzrange
column type.
defmodule Core.Repo.Migrations.AddThings do
use Ecto.Migration
def change do
create table(:things) do
add :profile_id, references(:profiles), null: false
add :performed_during, :tstzrange
end
end
end
Ecto.DateTime.Time
ranges can be indicated in migrations with the :tsrange
column type.
defmodule Core.Repo.Migrations.AddThings do
use Ecto.Migration
def change do
create table(:things) do
add :profile_id, references(:profiles), null: false
add :performed_every, :tsrange
end
end
end
indexes
Indexes
GIST
or SP-GIST
indexes and constraints can include range operators:
defmodule Core.Repo.Migrations.ExcludeOverlappingThings do
use Ecto.Migration
def change do
create constraint(
:things,
:no_overlapping_things,
exclude: ~s|gist (profile_id with =, performed_during with &&)|
)
end
end