Skip to main content

MigrationConfig

The user-authored form of a single migration — an entry of MigrationPackageConfig.migrations, or the shape of a migration.json/migration.ts manifest file. Resolving it produces a Migration.

PropertyTypeRequiredDescription
versionnumberyesMigration version number. Must be unique within the package; migrations run in ascending order regardless of declaration order.
backupbooleannoWhen true on any migration in the package, DbMigrator.execute() emits backup and calls backupDatabase() before applying migrations. No bundled adapter implements a backup, so since v6.3.0 the base adapter rejects this and the run fails rather than proceeding unprotected; up to v6.2.1 it was accepted and did nothing. See Running Migrations.
tasks(string | MigrationTask | (() => MigrationTask) | (() => Promise<MigrationTask>))[]yesTasks to run for this version — a glob pattern matching *.task.sql/*.task.json files, an inline task object, or a (sync or async) function returning one.
migration.json
{
"version": 13,
"tasks": ["*"]
}

MigrationTask is a union of SqlScriptMigrationTask, InsertDataMigrationTask, and CustomMigrationTask. See Writing Migration Tasks.