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.
This commit is contained in:
implementer
2026-08-30 01:17:23 +00:00
parent 4f169ace4e
commit f6d407394d
6 changed files with 219 additions and 10 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
* Migration ledger — [E00-S03-T03].
*
* The ledger is the PostgreSQL table that records applied migrations, so the
* migration runner (built on this boundary in later stories — advisory lock
* E00-S03-T04, failure diagnostic E00-S03-T05) can tell which migrations have
* migration runner (built on this boundary — the advisory lock E00-S03-T04
* and the failure diagnostic E00-S03-T05) can tell which migrations have
* already been applied and apply the rest exactly once.
*
* The ledger lives in `database-postgres` — the single workspace package