Packages
vtc
0.16.7
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.9
0.16.8
0.16.7
0.16.6
0.16.5
0.16.4
0.16.2
0.16.1
0.16.0
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.15
0.13.14
0.13.13
0.13.12
0.13.11
0.13.10
0.13.9
0.13.8
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.1
0.12.0
0.11.1
0.11.0
0.10.10
0.10.9
0.10.8
0.10.7
0.10.6
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.2
0.9.1
0.9.0
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.3
0.7.2
0.7.1
0.7.0
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.4.0
0.3.9
0.3.8
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
A SMPTE timecode library for Elixir
Current section
Files
Jump to
Current section
Files
lib/ecto/postgres/postgres_migrations.ex
use Vtc.Ecto.Postgres.Utils
defpgmodule Vtc.Ecto.Postgres.Migrations do
@moduledoc """
Top-level migrations for creating all Vtc ecto types.
"""
alias Vtc.Ecto.Postgres.PgFramerate
alias Vtc.Ecto.Postgres.PgFramestamp
alias Vtc.Ecto.Postgres.PgRational
alias Vtc.Ecto.Postgres.PgTypeMigration
@doc """
Runs all migrations. Safe to run multiple times when updates are required.
Migrations are run for:
- [PgRational](`Vtc.Ecto.Postgres.PgRational.Migrations`).
- [PgFramerate](`Vtc.Ecto.Postgres.PgFramerate.Migrations`).
- [PgFramestamp](`Vtc.Ecto.Postgres.PgFramestamp.Migrations`).
- [PgFramestamp.Range](`Vtc.Ecto.Postgres.PgFramestamp.Range.Migrations`).
All migrations implement both `up` and `down` functionality, and support rollbacks
out of the box.
## Options
- `rational`: Options to pass to
[PgRational.Migrations.run/0](`Vtc.Ecto.Postgres.PgRational.Migrations.run/0`).
- `framerate`: Options to pass to
[PgFramerate.Migrations.run/0](`Vtc.Ecto.Postgres.PgFramerate.Migrations.run/0`).
- `framestamp`: Options to pass to
[PgFramestamp.Migrations.run/0](`Vtc.Ecto.Postgres.PgFramestamp.Migrations.run/0`).
- `framestamp_range`: Options to pass to
[PgFramestamp.Rage.Migrations.run/0](`Vtc.Ecto.Postgres.PgFramestamp.Range.Migrations.run/0`).
> #### Required Permissions {: .warning}
>
> To add the `framestamp_range`
> [canonical](https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DISCRETE),
> function, we must directly add it to the `framestamp_range` type in the `pg_catalog`
> table. In most databases, this will require elevated permissions. See the
> `PgFramestamp.Range.Migrations.inject_canonical_function/0` for more information on
> why this is required.
>
> You can choose to skip this step if you wish by setting the `inject_canonical?`
> op to false, but operations that require discreet nudging of in-and-out points will
> not return correct results, and ranges with different upper/lower bound types will
> not be comparable.
"""
@spec run(
rational: [include: Keyword.t(atom()), exclude: Keyword.t(atom())],
framerate: [include: Keyword.t(atom()), exclude: Keyword.t(atom())],
framestamp: [include: Keyword.t(atom()), exclude: Keyword.t(atom())],
framestamp_range: [include: Keyword.t(atom()), exclude: Keyword.t(atom())]
) :: :ok
def run(opts \\ []) do
migrations = [
PgRational.Migrations,
PgFramerate.Migrations,
PgFramestamp.Migrations,
PgFramestamp.Range.Migrations
]
PgTypeMigration.run_all(migrations, opts)
:ok
end
end