GenDurable.Migration (gen_durable v0.1.0)

Copy Markdown View Source

Library-owned schema migration (Oban-style).

The host application does not copy the DDL; it writes a one-line Ecto migration that delegates here:

defmodule MyApp.Repo.Migrations.SetupGenDurable do
  use Ecto.Migration

  def up,   do: GenDurable.Migration.up()
  def down, do: GenDurable.Migration.down()
end

Options

  • :prefix — Postgres schema the tables live in (default "public").
  • :version — schema version to migrate to (default: latest for up/1, 0 for down/1).

The installed schema version is recorded in COMMENT ON TABLE gen_durable, so up/1 only applies the increments that are missing. This keeps the host-facing call stable as the schema evolves across library releases.

Summary

Functions

Migrate the schema down to :version (default: 0, i.e. drop everything).

Migrate the schema up to :version (default: latest).

Functions

down(opts \\ [])

Migrate the schema down to :version (default: 0, i.e. drop everything).

up(opts \\ [])

Migrate the schema up to :version (default: latest).