Ecto migration helpers for Tempo.Ecto.SQLite.TempoRange columns.
import Tempo.SQL.SQLite.Migration
create table(:meetings) do
add_tempo_range :window
end
create_tempo_range_index :meetings, :windowThe column is TEXT, holding the JSON document
Tempo.SQL.SQLite.Document writes, whichever frame the field is on.
The index is a pair of expression indexes on the document's lower and
upper bounds, which the comparisons Tempo.Ecto.SQLite.QueryAPI
writes are answered from.
Summary
Functions
Adds a TEXT column for a Tempo.Ecto.SQLite.TempoRange field.
Creates the expression indexes on the bounds of a
Tempo.Ecto.SQLite.TempoRange column.
Functions
Adds a TEXT column for a Tempo.Ecto.SQLite.TempoRange field.
Arguments
fieldis the column name as an atom.optionsis a keyword list of options.
Options
:frameis the field's frame,:utc(the default) or:floating. The column isTEXTon either; the option is checked and taken out.Every other option is passed through to
Ecto.Migration.add/3.
Returns
- The column declaration, as
Ecto.Migration.add/3returns it. Call it inside acreate tableblock.
Examples
add_tempo_range :window
add_tempo_range :opening_hours, frame: :floating, null: false
Creates the expression indexes on the bounds of a
Tempo.Ecto.SQLite.TempoRange column.
Two indexes are created, <table>_<column>_lo_index on the lower
bound and <table>_<column>_hi_index on the upper, so that a query
bounding either end of the column's spans is answered by an index.
Arguments
tableis the table name as an atom.columnis the column name as an atom.
Returns
- The two
CREATE INDEXstatements, asEcto.Migration.execute/2returns them. Both are reversible.
Examples
create_tempo_range_index :meetings, :window