Skip to content

Interface: SQLAdapterMigatorType

A type representing the public migration methods available on a Knex Migrator, but with all methods as zero-argument functions returning the same type as the original. This omits the 'make' method, which is internal to Knex.

The methods are:

  • latest: Run all pending migrations.
  • rollback: Roll back the last batch of migrations.
  • status: Get the current migration status (number of migrations run or a status code).
  • currentVersion: Get the current migration version (as a string or number).
  • list: List all completed and pending migrations.
  • up: Run the next migration that has not yet been run.
  • down: Roll back the last migration that was run.
  • forceFreeMigrationsLock: Force release the migration lock if stuck.

Properties

PropertyTypeDescription
currentVersion() => Promise<string>Get the current migration version (as a string or number). Equivalent to knex.migrate.currentVersion().
down() => Promise<any>Roll back the last migration that was run. Equivalent to knex.migrate.down().
forceFreeMigrationsLock() => Promise<any>Force release the migration lock if stuck. Equivalent to knex.migrate.forceFreeMigrationsLock().
latest() => Promise<any>Run all pending migrations. Equivalent to knex.migrate.latest().
list() => Promise<any>List all completed and pending migrations. Equivalent to knex.migrate.list().
rollback() => Promise<any>Roll back the last batch of migrations. Equivalent to knex.migrate.rollback().
status() => Promise<number>Get the current migration status (number of migrations run or a status code). Equivalent to knex.migrate.status().
up() => Promise<any>Run the next migration that has not yet been run. Equivalent to knex.migrate.up().