Run on Postgres with today's schema #28
Reference in New Issue
Block a user
Delete Branch "feat/db-change"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #20.
Swaps
modernc.org/sqliteforjackc/pgx/v5with no observable change: same endpoints, same wire format, sameupdated_atordering rule. The foundation the rest of #18 sits on, and its value is that it is boring.Schema is migration-owned
Numbered SQL embedded via
go:embed, applied on startup, one transaction each, recorded inschema_migrations. Files are append-only. That replaces two pieces of SQLite-era machinery, both deleted rather than ported:ADD COLUMN IF NOT EXISTS, and there is no legacy database left to probe.latest.asuraBuildHash, where the poller still needs it to scope chapter links for a series whose slug carries a rotating hash.The six tests that seeded legacy SQLite schemas went with them;
TestOpenIsIdempotentreplaces the one assertion worth keeping.Dialect
favoriteis a real boolean, chapter numbers aredouble precision, timestamps stay unix-msbigint. Every?is$N;bookmarkColumnsremains the only compile-time constant concatenated into query text. SQLite's null-safeIS NOTbecomesIS DISTINCT FROM, which is what implements the rule that only reading progress reorders a list.The
::textcasts on$14/$15are load-bearing: insideCOALESCE/NULLIFthere is no target column to infer the parameter type from and Postgres refuses to guess.Tests need Docker now
internal/pgteststarts onepostgres:17-alpineper test binary (TestMain→pgtest.Main) and hands each test a database of its own. Hand-rolled rather than testcontainers — onedocker run, onedocker portand a ping loop, against a module list that is otherwise stdlib. This is the permanent cost ADR-0001 flagged and the main reason the decision was close.Verification
go test -count=1 ./...green in 7.3s;gofmt/go vetclean.GET/PUT/DELETE, 204 preflight with CORS headers, web UI. A favourite toggle leftupdated_atat…5958; a progress write moved it to…6013.\d bookmarksconfirms the column types. Restart on a populated database re-runs the migration silently.Deploying this
mainis not deployable until #25 and #26. Compose now demandsPOSTGRES_PASSWORDand starts on an empty Postgres, so agit pull && docker compose up -don the VPS before the import lands would serve an empty library. The 29 rows are safe — the pre-migrationbookmarks-datavolume is deliberately left undeclared sodocker compose down -vcannot take it — but nothing reads them yet.REDEPLOY.mdandDEPLOY.mdwere rewritten off SQLite:pg_dump -Fc/pg_restorereplaceVACUUM INTO, and the-wal/-shmandchown 65532advice is gone.Not in scope
The reader/series/session split, Discord OAuth, per-Reader tokens and the 29-row import stay in #21–#26.
Adds docs/agents/{issue-tracker,triage-labels,domain}.md so the engineering skills know where issues live (Gitea via tea, not gh), which triage labels to apply, and that domain docs are single-context. Every CLAUDE.md was a stale subset of the AGENTS.md beside it, so each is now a symlink and AGENTS.md is the single source of truth.