DbMigratorOptions
Options accepted by DbMigrator.execute().
| Property | Type | Required | Description |
|---|---|---|---|
connection | ClientConfiguration | yes | Connection info for the target database. connection.dialect must be 'postgres' — see the warning in Running Migrations. |
migrationPackage | MigrationPackage | MigrationPackageConfig | yes | The migrations to apply. |
infoSchema | string | no | Schema used for the migrator's bookkeeping tables (migration_summary, migration_events). Defaults to __migration. |
scriptVariables | Record<string, string> | no | Additional $(name) substitution variables for .task.sql scripts, merged with the adapter's own defaults (schema, tablespace, owner) and connection.schema. |
targetVersion | number | no | Migrate up to (and including) this version. Defaults to the package's highest version. |
ClientConfiguration is defined by @sqb/connect — see its
interface reference.
import type { DbMigratorOptions } from '@sqb/migrator';
const options: DbMigratorOptions = {
connection: { dialect: 'postgres', database: 'my_database' },
migrationPackage: { name: 'my-app', migrations: ['migrations/**/*'] },
targetVersion: 14,
};
See Running Migrations for usage.