Skip to main content

MigrationPackageConfig

The user-authored, not-yet-resolved form of a migration package — what you pass as migrationPackage to DbMigrator.execute(), or to MigrationPackage.load() directly. Resolving one (loading glob patterns, manifest files, and functions) produces a MigrationPackage.

PropertyTypeRequiredDescription
namestringyesPackage name. Used as the row key in the migration_summary bookkeeping table, so it should be stable and unique per application/schema.
descriptionstringnoFree-text description.
baseDirstringnoBase directory that string glob patterns in migrations are resolved against. Defaults to the directory of the file that called MigrationPackage.load().
informationTableNamestringnoReserved for future use.
migrations(string | MigrationConfig | (() => MigrationConfig) | (() => Promise<MigrationConfig>))[]yesMigrations to include — a glob pattern (discovers migration.json/migration.ts/migration.js/migration.cjs/migration.mjs manifest files), an inline MigrationConfig object, or a (sync or async) function returning one.
import type { MigrationPackageConfig } from '@sqb/migrator';

const config: MigrationPackageConfig = {
name: 'my-app',
migrations: ['migrations/**/*'],
};

See Writing Migration Tasks for the two ways of laying out migrations (inline vs. folder discovery).