Files
PersonalBlog/packages/database-postgres/src/index.ts
T
implementer f6d407394d feat: add migration runner with structured failure diagnostic (E00-S03-T05)
MigrationRunner applies pending migrations through the migration ledger
exactly once; when a migration fails it throws a MigrationFailedError
whose diagnostic is a structured object identifying the failing migration
(version), the failure phase (apply/record), the underlying cause, and the
applied/pending ledger state, serializable via toJSON. Re-exported from
the driver boundary so no other package needs the pg driver to run
migrations. Advisory lock (T04) and ready gate (T06) remain out of scope.
2026-08-30 01:17:23 +00:00

27 lines
1.3 KiB
TypeScript

/**
* @personal-blog/database-postgres — EPPP PostgreSQL adapter package.
*
* [E00-S03-T02] this package is the single owner of the PostgreSQL driver
* stack: it is the only workspace package allowed to import `pg` and Kysely.
* Every piece of the workspace that talks to the database goes through this
* boundary — the pool, the query builder dialect and the adapter API this
* package will expose — so no other package ever imports the driver directly.
*
* This module is the driver boundary: it imports the PostgreSQL driver (`pg`)
* and Kysely and re-exports the pieces the adapter is built on — the driver
* surface (E00-S03-T02), the migration ledger (E00-S03-T03), the migration
* advisory lock (E00-S03-T04) and the migration runner with its failure
* diagnostic (E00-S03-T05). Keeping every re-export here means the driver
* stays reachable only from this package — the isolation is real, not a
* placeholder.
*/
import { Pool } from 'pg';
import { Kysely, PostgresDialect } from 'kysely';
export { Pool, Kysely, PostgresDialect };
export { MigrationLedger, MIGRATION_LEDGER_TABLE } from './ledger.js';
export { MigrationLock, MIGRATION_LOCK_KEY } from './lock.js';
export { MigrationRunner, MigrationFailedError } from './runner.js';
export type { Migration, MigrationDiagnostic, MigrationRunResult, MigrationFailurePhase } from './runner.js';