View Source Membrane.RTC.Engine.TimescaleDB.Migrations (Membrane RTC Engine TimescaleDB plugin v0.2.0)
Migrations creating DB tables required by this library to function.
To execute migrations, run Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.up(versions: 1..2)
or Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.up(version: 2)
.
To undo them, run Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.down(versions: 1..2)
or Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.down(version: 2)
accordingly.
Currently, the latest migrations version is 2
Suggested way of using functions from this module, is to create a migration module in your own
project and call them there. Remember, that versions passed to down
should match ones passed to
up
. Here's an example:
defmodule MyApp.CreateRtcEngineTimescaledbTables do
use Ecto.Migration
@spec up() :: :ok
def up() do
:ok = Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.up(versions: 1..2)
end
@spec down() :: :ok
def down() do
:ok = Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.down(versions: 1..2)
end
end
When updating, create a new migration applying newer TimescaleDB
migrations, e.g. assuming you
already have migrations to version 1, you should write:
defmodule MyApp.UpdateRtcEngineTimescaledbTablestoV2 do
use Ecto.Migration
@spec up() :: :ok
def up() do
:ok = Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.up(version: 2)
end
@spec down() :: :ok
def down() do
:ok = Elixir.Membrane.RTC.Engine.TimescaleDB.Migrations.down(version: 2)
end
end
Link to this section Summary
Link to this section Types
@type version_spec() :: [{:version, pos_integer()}] | [{:versions, Range.t()}]
Link to this section Functions
@spec down() :: :ok
@spec down(version_spec()) :: :ok
Reverts Ecto DB migrations from a specified version. Should be called from down
callback of
Ecto migration.
Accepts either [version: version]
to revert a single migration to version
or [versions: from..to]
that reverts migrations from passed range leaving DB at version from - 1
@spec up() :: :ok
@spec up(version_spec()) :: :ok
Applies Ecto DB migrations to a specified version. Should be called from up
callback of
Ecto migration.
Accepts either [version: version]
to run a single migration from previous to version
or [versions: from..to]
that migrates from from - 1
to to
version.