Migrating from v0.8.x to v1.0.0

This guide covers breaking public API renames, naming changes, and the new abstract runner base class in MSR Core v1.0.0.

Table of contents

  1. What changed
  2. New and corrected CLI behavior
  3. Migration steps
    1. 1. Upgrade the package
    2. 2. Update imports and inheritance
    3. 3. Replace direct construction with a concrete runner
    4. 4. Rename the CLI factory callback
    5. 5. Rename lock owner identifiers
    6. 6. Update provider and orchestrator APIs
    7. 7. Search for old names
  4. Verification
  5. Current API references

What changed

The core class and its public option and dependency types now use the Runner name:

Before (v0.8.x) After (v1.0.0)
MigrationScriptExecutor MigrationScriptRunner (abstract base class)
IExecutorOptions IRunnerOptions
IMigrationExecutorDependencies IRunnerDependencies
ILockingService ILockingProvider
ITransactionManager ITransactionProvider
DefaultTransactionManager DefaultTransactionProvider
CallbackTransactionManager CallbackTransactionProvider
BackupService / IBackupService BackupOrchestrator / IBackupOrchestrator
SchemaVersionService / ISchemaVersionService SchemaVersionOrchestrator / ISchemaVersionOrchestrator
Handler lockingService / transactionManager Handler lockingProvider / transactionProvider
Runner options backupService / schemaVersionService backupOrchestrator / schemaVersionOrchestrator
No lock orchestration interface ILockingOrchestrator contract
CLI factory callback createExecutor → createRunner
Lock owner identifier and storage column executorId / executor_id → runnerId / runner_id

There are no backward-compatible aliases. MigrationScriptRunner is abstract in v1.0.0, so direct construction is no longer allowed; create a concrete adapter subclass. Update imports, base classes, constructor and factory signatures, and type references together. Database-specific implementation classes should follow the <Database>Runner naming convention, such as FirebaseRunner or PostgresRunner; see the CLI adapter development guide.

New and corrected CLI behavior

The following changes are additive or correct CLI behavior; they do not require a separate migration of existing configuration:

  • --backup-mode <mode> selects full (the default), create_only, restore_only, or manual. Unsupported values are rejected before an adapter runner is created.
  • Adapter-specific flags can use dot notation to populate nested configuration, for example --mongo.uri mongodb://localhost:27017 or --firebase.hosts.0 primary.example.com. See Nested Configuration Flags.
  • --logger, --log-level, and --format now validate their documented values and pass the selected logger, log level, and JSON rendering strategy through the runner factory. Adapter createRunner factories should forward the supplied logger and render strategy into the runner dependencies; see the CLI reference.

Migration steps

1. Upgrade the package

MSR Core v1.0.0 requires Node.js 22 or later. Update the Node.js runtime used by your local development environment, containers, and CI before or alongside this upgrade; see the compatibility policy.

npm install @migration-script-runner/core@^1.0.0

2. Update imports and inheritance

// Before (v0.8.x)
import {
  MigrationScriptExecutor,
  IExecutorOptions,
  IMigrationExecutorDependencies
} from '@migration-script-runner/core';

export class FirebaseAdapter extends MigrationScriptExecutor<IFirebaseDB, FirebaseHandler> {
  private constructor(dependencies: IMigrationExecutorDependencies<IFirebaseDB, FirebaseHandler>) {
    super(dependencies);
  }

  static getInstance(options: IExecutorOptions<IFirebaseDB>): Promise<FirebaseAdapter> {
    // Create the handler and return the adapter.
  }
}
// After (v1.0.0)
import {
  MigrationScriptRunner,
  IRunnerOptions,
  IRunnerDependencies
} from '@migration-script-runner/core';

export class FirebaseRunner extends MigrationScriptRunner<IFirebaseDB, FirebaseHandler, FirebaseConfig> {
  private constructor(dependencies: IRunnerDependencies<IFirebaseDB, FirebaseHandler, FirebaseConfig>) {
    super(dependencies);
  }

  static override getInstance(options: IRunnerOptions<IFirebaseDB, FirebaseConfig>): Promise<FirebaseRunner> {
    return this.createInstance(
      options,
      () => new FirebaseConfig(),
      (config) => FirebaseHandler.getInstance(config),
      (dependencies) => new FirebaseRunner(dependencies)
    );
  }
}

Adapt the return type and factory body to your actual initialization pattern. If the adapter class is imported by consumers, renaming it to <Database>Runner is a source-level breaking change for those consumers as well.

3. Replace direct construction with a concrete runner

Code that previously instantiated MigrationScriptExecutor directly must now use a concrete subclass of MigrationScriptRunner. Async adapters override getInstance() and use Core’s helper to resolve typed configuration before creating the handler:

class FirebaseRunner extends MigrationScriptRunner<IFirebaseDB, FirebaseHandler, FirebaseConfig> {
  private constructor(dependencies: IRunnerDependencies<IFirebaseDB, FirebaseHandler, FirebaseConfig>) {
    super(dependencies);
  }

  static override getInstance(options: IRunnerOptions<IFirebaseDB, FirebaseConfig>): Promise<FirebaseRunner> {
    return this.createInstance(
      options,
      () => new FirebaseConfig(),
      (config) => FirebaseHandler.getInstance(config),
      (dependencies) => new FirebaseRunner(dependencies)
    );
  }
}

const runner = await FirebaseRunner.getInstance({ config });
await runner.up();

If your handler already exists, a minimal subclass can pass it through its constructor:

class MyRunner extends MigrationScriptRunner<IMyDB> {}
const runner = new MyRunner({ handler, config });

4. Rename the CLI factory callback

Rename the createExecutor property to createRunner, including the callback passed to extendCLI. The v1.0.0 API does not provide a createExecutor compatibility alias.

// Before (v0.8.x)
const oldProgram = createCLI<IFirebaseDB, FirebaseRunner>({
  createExecutor: async (config) => FirebaseRunner.getInstance({ config }),
  extendCLI: async (program, createExecutor) => {
    const runner = await createExecutor();
  }
});
// After (v1.0.0)
const program = createCLI<IFirebaseDB, FirebaseRunner>({
  createRunner: async (config) => FirebaseRunner.getInstance({ config }),
  extendCLI: async (program, createRunner) => {
    const runner = await createRunner();
  }
});

5. Rename lock owner identifiers

Update locking provider methods and lock hook callbacks from executorId to runnerId. If your locking provider stores the identifier in a database column named executor_id, rename that column to runner_id and update its queries. Adapt the table name and SQL syntax to your database. Complete this migration while old application instances are stopped so old and new instances do not coordinate through different lock columns.

For example, in PostgreSQL:

ALTER TABLE migration_locks RENAME COLUMN executor_id TO runner_id;

6. Update provider and orchestrator APIs

Database adapters now provide locking and transaction capabilities through provider contracts. Rename implementations and handler properties:

// Before (v0.8.x)
class PostgreSqlLockingProvider implements ILockingProvider<PostgreSqlDB> {
  // database-specific lock operations
}

const handler = {
  lockingService: new PostgreSqlLockingService(db),
  transactionManager: new CustomTransactionManager(db)
};
// After (v1.0.0)
class PostgreSqlLockingProvider implements ILockingProvider<PostgreSqlDB> {
  // database-specific lock operations
}

const handler = {
  lockingProvider: new PostgreSqlLockingProvider(db),
  transactionProvider: new CustomTransactionProvider(db)
};

MSR orchestration types also use explicit names:

  • BackupService / IBackupService become BackupOrchestrator / IBackupOrchestrator.
  • SchemaVersionService / ISchemaVersionService become SchemaVersionOrchestrator / ISchemaVersionOrchestrator.
  • LockingOrchestrator now implements the exported ILockingOrchestrator contract.
  • Built-in transaction implementations become DefaultTransactionProvider and CallbackTransactionProvider.
  • IRunnerOptions properties backupService and schemaVersionService become backupOrchestrator and schemaVersionOrchestrator.

Rename direct imports, custom implementation types, and property names together. The built-in class renames are breaking for consumers that instantiate these classes directly.

7. Search for old names

Search your source, tests, locking-provider implementations, and current documentation for renamed API symbols and properties, then update each remaining reference. Historical release notes may retain old names where they describe the API that existed in that release.

Verification

After updating the adapter:

  1. Run the TypeScript build and your test suite.
  2. Confirm public imports resolve from @migration-script-runner/core.
  3. Search for old API symbols, createExecutor, executorId, and executor_id in current source and examples.
  4. Confirm your CLI factory uses createRunner and your locking implementation uses runnerId / runner_id.

Current API references