~bigbes/sr-ht-spec: 4562b448

feat: specsrht-migrate — brant wrapper for the spec.sr.ht schema

Single-service wrapper around git.sr.ht/~bitfehler/brant, a close sibling of
doltsrht-migrate: the brant subcommands (up, down, current, list, stamp,
validate, ping) plus an extra `init` that applies schema.sql wholesale and
stamps to head for a fresh install.

The DSN comes from [spec.sr.ht]connection-string unless --dsn overrides it;
a missing or empty value is a fatal error rather than a default connection.
Migrations load from ./migrations in a checkout, else from
<[sr.ht]assets>/migrations/spec.sr.ht. -a honours [spec.sr.ht]migrate-on-upgrade
and exits early when it is off. lib/pq's "postgres" driver replaces brant's
pgx default, which this module does not link.

Tests cover flag parsing, DSN precedence and the migrations-directory
resolution order without a database; the init/up round trips against a scratch
schema skip unless SPECSRHT_TEST_PG is set.

Eugene Blikh <bigbes@gmail.com> — 2026-07-22 10:45:57 UTC

Commit 4562b448f2d5b5e1ad9570f8c2b6b6ee2db80213view raw patch

Parent(s): 1f4a8eda

2 changed file(s)

FileStatus+
cmd/specsrht-migrate/main.go A +202
cmd/specsrht-migrate/main_test.go A +437