diff --git a/packages/database-postgres/src/runner.ts b/packages/database-postgres/src/runner.ts index 8d65f0a..f2f36c5 100644 --- a/packages/database-postgres/src/runner.ts +++ b/packages/database-postgres/src/runner.ts @@ -33,7 +33,7 @@ */ import type { Pool } from 'pg'; -import { MigrationLedger } from './ledger.js'; +import type { MigrationLedger } from './ledger.js'; /** * A single migration step: an identifier (recorded in the ledger once the @@ -136,14 +136,17 @@ export class MigrationRunner { private readonly migrations: readonly Migration[]; /** - * @param pool The package-owned PostgreSQL pool (`pg.Pool`). + * @param pool The package-owned PostgreSQL pool (`pg.Pool`), handed to each + * migration's `up`. * @param migrations The migrations to run, in apply order (oldest first). - * @param ledger The migration ledger; defaults to one sharing `pool`. + * @param ledger The migration ledger (E00-S03-T03) the runner reads applied + * versions from and records applied migrations into; constructed by the + * caller from the same pool (`new MigrationLedger(pool)`). */ - constructor(pool: Pool, migrations: readonly Migration[], ledger?: MigrationLedger) { + constructor(pool: Pool, migrations: readonly Migration[], ledger: MigrationLedger) { this.pool = pool; this.migrations = migrations; - this.ledger = ledger ?? new MigrationLedger(pool); + this.ledger = ledger; } /**