Skip to main content

Migration

A single resolved version step inside a MigrationPackage — the resolved counterpart of a MigrationConfig, with every task loaded.

PropertyTypeRequiredDescription
versionnumberyesThe version number this migration advances the schema to. DbMigrator runs migrations in ascending version order; two migrations in the same package can't share a version.
tasksMigrationTask[] (see MigrationConfig for the MigrationTask union)yesResolved tasks to execute, in order, for this version.
baseDirstringyesDirectory this migration's own relative task-file references are resolved against.
backupbooleannoIf true, DbMigrator emits a backup event and calls the adapter's backupDatabase() before running the package's tasks. No bundled adapter implements a backup, so since v6.3.0 the run fails with Database backup is not supported by <Adapter>; up to v6.2.1 the flag was accepted and did nothing. Use transaction: 'run' for a run that leaves no trace when it fails.

See Writing Migration Tasks for how migrations are laid out on disk.