Versioned schema migrations for CouncilEx's opt-in Ecto-backed
features (Registry, Reliability, Recorder). Modeled after
Oban.Migration.
Usage
Generate a regular Ecto migration in your application and delegate the up/down to this module:
defmodule MyApp.Repo.Migrations.AddCouncilEx do
use Ecto.Migration
def up, do: CouncilEx.Persistence.Migration.up()
def down, do: CouncilEx.Persistence.Migration.down()
endRun with mix ecto.migrate like any other migration. Subsequent
schema bumps land as new versions; you call up(version: N) from a
new migration file to step forward.
Options
:version— target schema version. Defaults to the latest shipped version (Elixir.CouncilEx.Persistence.Migration.current_version/0). When steppingup/1, the module migrates from the highest applied version up to this target. When steppingdown/1, it reverses from the current applied version down to one below this target.:components— which subsystems to install. Atom or list. Valid values::all(default) — every component:registry—<prefix>registrytable backingCouncilEx.Registry.Ecto:reliability—<prefix>reliabilitytable backingCouncilEx.Reliability.Ecto:recorder—<prefix>runsand<prefix>run_eventstables backingCouncilEx.Recorder.Ecto
Pass a subset to opt out of components you do not use:
CouncilEx.Persistence.Migration.up(components: [:recorder]):table_prefix— string prepended to every table name. Defaults to"council_ex_". Pick a different prefix if the default collides with your application's tables.
All options must match between up/1 and down/1 for a given
migration. Mixing components or prefixes between paired up/down
calls leaves orphaned tables.
Summary
Functions
Highest schema version shipped by this release.
Migrate down to (and excluding) :version — i.e. reverse versions
current..version in descending order. Defaults to dropping every
installed version.
Migrate up to :version (default: latest).
Functions
@spec current_version() :: pos_integer()
Highest schema version shipped by this release.
@spec down(keyword()) :: :ok
Migrate down to (and excluding) :version — i.e. reverse versions
current..version in descending order. Defaults to dropping every
installed version.
@spec up(keyword()) :: :ok
Migrate up to :version (default: latest).
See moduledoc for the full option list.