IMigrator
Implemented by
Index
Methods
checkMigrationNeeded
Returns Promise<boolean>
createInitialMigration
Creates initial migration. This generates the schema based on metadata, and checks whether all the tables are already present. If yes, it will also automatically log the migration as executed. Initial migration can be created only if the schema is already aligned with the metadata, or when no schema is present - in such case regular migration would have the same effect.
Parameters
optionalpath: string
Returns Promise<MigrationResult>
createMigration
Checks current schema for changes, generates new migration if there are any.
Parameters
optionalpath: string
optionalblank: boolean
optionalinitial: boolean
optionalname: string
Returns Promise<MigrationResult>
down
Executes down migrations to the given point. Without parameter it will migrate one version down.
Parameters
optionaloptions: string | string[] | MigrateOptions
Returns Promise<UmzugMigration[]>
getExecutedMigrations
Returns list of already executed migrations.
Returns Promise<MigrationRow[]>
getPendingMigrations
Returns list of pending (not yet executed) migrations found in the migration directory.
Returns Promise<UmzugMigration[]>
off
Removes event handler.
Parameters
event: MigratorEvent
listener: (event: UmzugMigration) => MaybePromise<void>
Returns IMigrator
on
Registers event handler.
Parameters
event: MigratorEvent
listener: (event: UmzugMigration) => MaybePromise<void>
Returns IMigrator
up
Executes specified migrations. Without parameter it will migrate up to the latest version.
Parameters
optionaloptions: string | string[] | MigrateOptions
Returns Promise<UmzugMigration[]>
Checks current schema for changes.