Test the migration runner, including the edited-file halt

Migrations are append-only because the runner checksums each file: edit one that
has already run and it stops there, so every migration after it never applies
and the app boots on a half-built schema. That failure is silent, it is not
fixable after the fact — renaming a file changes its checksum too — and it has
already cost one crash loop. Nothing tested it.

Four tests against a scratch directory, so they can do the thing nobody may do
to static/migrations: pending files all apply and a second run is a no-op, a
file added after the others applies, an edited applied file is reported as an
error *and* the migration after it is demonstrably skipped, and invalid SQL
cannot pass silently.

The last one documents a contract worth knowing: a SQL syntax error propagates
as an exception rather than a MigrationError return value, so the caller's
fail-fast case in System.Config never sees it — startup still aborts, just by a
different route.

runPendingMigrations is now exported so it can be driven directly.
This commit is contained in:
Anthony Alaribe 2026-08-20 01:28:42 +02:00
commit 56d40e13ba
3 changed files with 108 additions and 1 deletions