[E00-S03-T05] Migration failure produces structured diagnostic #394
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user