glimr_postgres/db/migrate

PostgreSQL Migration Database Operations

Provides database operations for running migrations. Handles the migrations tracking table and applying migration SQL to the database.

Values

pub fn apply_pending(
  conn: pog.Connection,
  pending: List(migrate.Migration),
) -> Result(List(String), pog.QueryError)

Applies a list of migrations, stopping on first error. Returns the list of successfully applied version strings or the first error encountered.

pub fn ensure_table(
  conn: pog.Connection,
) -> Result(Nil, pog.QueryError)

Creates the migrations tracking table if it doesn’t exist. Uses _glimr_migrations to track which migrations have been applied to the database.

pub fn get_applied(
  conn: pog.Connection,
) -> Result(List(String), pog.QueryError)

Gets the list of applied migration versions from the database. Returns versions in sorted order for comparison against available migration files.

Search Document