Postgres module

migrate

procedure · 1 overloadsince 0.27.0Source

Applies the pending migrations in order, each in its own transaction, and returns how many it applied. An advisory lock keeps two processes from migrating at once. It refuses (applying nothing) when an applied migration changed or disappeared, or a pending one is numbered below the newest applied one, unless options allows it.

migrate :: (
    c: *Connection,
    migrations: [] Migration,
    options := Migrate_Options.{}
) -> (applied: s64, Pg_Error)

Applies the pending migrations in order, each in its own transaction, and returns how many it applied. An advisory lock keeps two processes from migrating at once. It refuses (applying nothing) when an applied migration changed or disappeared, or a pending one is numbered below the newest applied one, unless options allows it.

Parameters

c: *Connection
the connection to migrate.
migrations: [] Migration
all the migrations, applied or not.
options := Migrate_Options.{}
what to allow.

Returns

applied: s64

See also