gorrion/runner
Executes migration SQL within transactions.
Values
pub fn apply_migration(
db: pog.Connection,
migration: types.Migration,
) -> Result(Nil, types.MigrationError)
Apply a single migration: execute the up SQL, then record it.
Both steps run inside the same database transaction so that a crash or
rollback between them can never leave the schema mutated without a
matching _schema_migrations row (or vice versa).
pub fn revert_migration(
db: pog.Connection,
migration: types.Migration,
) -> Result(Nil, types.MigrationError)
Revert a single migration: execute the down SQL, then remove the record.
If no down SQL was provided (empty string), just removes the tracking record.
Both steps run inside the same transaction for the same atomicity reason
described on apply_migration.