Class: SQLAdapterMigrator
A class that wraps Knex's migration API for use with Kyoo's SQL adapter, providing a consistent interface for running and managing migrations.
Example
const migrator = getSqlAdapterMigrator(config);
await migrator.latest();Implements
Methods
currentVersion()
currentVersion(): Promise<string>;Get the current migration version (as a string or number). Equivalent to knex.migrate.currentVersion().
Returns
Promise<string>
Implementation of
SQLAdapterMigatorType.currentVersion
down()
down(): Promise<any>;Roll back the last migration that was run. Equivalent to knex.migrate.down().
Returns
Promise<any>
Implementation of
forceFreeMigrationsLock()
forceFreeMigrationsLock(): Promise<any>;Force release the migration lock if stuck. Equivalent to knex.migrate.forceFreeMigrationsLock().
Returns
Promise<any>
Implementation of
SQLAdapterMigatorType.forceFreeMigrationsLock
latest()
latest(): Promise<any>;Run all pending migrations. Equivalent to knex.migrate.latest().
Returns
Promise<any>
Implementation of
list()
list(): Promise<any>;List all completed and pending migrations. Equivalent to knex.migrate.list().
Returns
Promise<any>
Implementation of
rollback()
rollback(): Promise<any>;Roll back the last batch of migrations. Equivalent to knex.migrate.rollback().
Returns
Promise<any>
Implementation of
SQLAdapterMigatorType.rollback
shutdown()
shutdown(): Promise<void>;Shuts down (destroys) the Knex instance underlying the migrator instance.
Returns
Promise<void>
WARNING
If an error occurs during shutdown by knex or one if its underlying libraries, it will be thrown
status()
status(): Promise<number>;Get the current migration status (number of migrations run or a status code). Equivalent to knex.migrate.status().
Returns
Promise<number>
Implementation of
up()
up(): Promise<any>;Run the next migration that has not yet been run. Equivalent to knex.migrate.up().
Returns
Promise<any>
