Skip to main content
Version: 5.9

abstractMigration

Index

Constructors

constructor

  • new Migration(driver: AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>, config: Configuration<IDatabaseDriver<Connection>>): Migration
  • Parameters

    • driver: AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>
    • config: Configuration<IDatabaseDriver<Connection>>

    Returns Migration

Methods

addSql

  • addSql(sql: Query): void
  • Parameters

    • sql: Query

    Returns void

down

  • down(): Promise<void>
  • Returns Promise<void>

execute

  • execute(sql: Query, params?: unknown[]): Promise<EntityData<Partial<any>>[]>
  • Executes a raw SQL query. Accepts a string SQL or a knex query builder instance. The params parameter is respected only if you use string SQL in the first parameter.


    Parameters

    • sql: Query
    • optionalparams: unknown[]

    Returns Promise<EntityData<Partial<any>>[]>

getEntityManager

  • getEntityManager(): SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>>
  • Creates a cached EntityManager instance for this migration, which will respect the current transaction context.


    Returns SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>>

getKnex

  • getKnex(): Knex<any, any[]>
  • Returns Knex<any, any[]>

getQueries

  • getQueries(): Query[]
  • Returns Query[]

isTransactional

  • isTransactional(): boolean
  • Returns boolean

reset

  • reset(): void
  • Returns void

setTransactionContext

  • setTransactionContext(ctx: any): void
  • Parameters

    • ctx: any

    Returns void

abstractup

  • up(): Promise<void>
  • Returns Promise<void>