gorrion/tracker

Manages the _schema_migrations tracking table.

Values

pub fn current_version(
  db: pog.Connection,
) -> Result(Int, types.MigrationError)

Get the highest applied migration version, or 0 if none.

pub fn ensure_table(
  db: pog.Connection,
) -> Result(Nil, types.MigrationError)

Create the _schema_migrations table if it doesn’t exist.

pub fn get_applied(
  db: pog.Connection,
) -> Result(List(types.AppliedMigration), types.MigrationError)

Get all applied migrations, sorted by version ascending.

pub fn record(
  db: pog.Connection,
  version: Int,
  name: String,
) -> Result(Nil, types.MigrationError)

Record a migration as applied.

pub fn remove(
  db: pog.Connection,
  version: Int,
) -> Result(Nil, types.MigrationError)

Remove a migration record (used during rollback).

Search Document