API 参考
    正在准备搜索索引...

    Executes migrations: runs pending and reverts previously executed migrations.

    索引

    构造函数

    • 参数

      返回 MigrationExecutor

    属性

    connection: DataSource
    fake: boolean

    Option to fake-run or fake-revert a migration, adding to the executed migrations table, but not actually running it. This feature is useful for when migrations are added after the fact or for interoperability between applications which are desired to each keep a consistent migration history.

    queryRunner?: QueryRunner
    transaction: "all" | "none" | "each"

    Indicates how migrations should be run in transactions. all: all migrations are run in a single transaction none: all migrations are run without a transaction each: each migration is run in a separate transaction

    方法

    • 参数

      返回 void

    • Creates table "migrations" that will store information about executed migrations.

      参数

      返回 Promise<void>

    • Delete previously executed migration's data from the migrations table.

      参数

      返回 Promise<void>

    • Deletes an executed migration.

      参数

      返回 Promise<void>

    • Tries to execute a single migration given.

      参数

      返回 Promise<Migration>

    • Executes all pending migrations. Pending migrations are migrations that are not yet executed, thus not saved in the database.

      返回 Promise<Migration[]>

    • Returns an array of all migrations.

      返回 Promise<Migration[]>

    • Returns an array of all executed migrations.

      返回 Promise<Migration[]>

    • Finds the latest migration in the given array of migrations. PRE: Migration array must be sorted by descending id.

      参数

      返回 undefined | Migration

    • Finds the latest migration (sorts by timestamp) in the given array of migrations.

      参数

      返回 undefined | Migration

    • Gets all migrations that setup for this connection.

      返回 Migration[]

    • Returns an array of all pending migrations.

      返回 Promise<Migration[]>

    • Inserts new executed migration's data into migrations table.

      参数

      返回 Promise<void>

    • Inserts an executed migration.

      参数

      返回 Promise<void>

    • Loads all migrations that were executed and saved into the database (sorts by id).

      参数

      返回 Promise<Migration[]>

    • Lists all migrations and whether they have been executed or not returns true if there are unapplied migrations

      返回 Promise<boolean>

    • Reverts last migration that were run.

      返回 Promise<void>

    • 类型参数

      • T extends unknown

      参数

      返回 Promise<T>