prorm API Reference
    Preparing search index...

    Class PrormMigration

    PrormMigration - Integrates with Prorm to manage migrations

    Index
    • Record a migration as executed in the database

      Parameters

      • migration: Migration

        The migration to record

      • batch: number

        The batch number

      Returns Promise<void>

    • Remove a migration record from the database

      Parameters

      • migrationName: string

        Name of the migration to remove

      Returns Promise<void>

    • Check if a migration has been executed

      Parameters

      • migrationName: string

        Name of the migration

      Returns Promise<boolean>

    • Run a migration

      Parameters

      • migration: Migration

        The migration to run

      • Optionalbatch: number

        Optional batch number to record this migration under. When omitted, a fresh batch number is computed for this single migration. runMigrations() passes an explicit shared batch so that all migrations applied in one run land in the same batch.

      Returns Promise<void>

    • Revert migrations to a specific batch

      For each executed migration with a batch number greater than targetBatch, this loads its down() function (via the supplied migrations lookup) and actually executes it before removing its tracking row. If down() throws, the error is logged and re-thrown, and the tracking row for that migration (and any migrations after it) is left in place so the revert can be retried.

      Parameters

      • targetBatch: number

        Target batch number to revert down to

      • migrations: Migration[] | Map<string, Migration>

        The loaded Migration definitions (with down() functions attached), keyed by migration name. Typically Migrator.getMigrations() / the Migrator's internal migrations map.

      Returns Promise<void>