First M1 step — replace the stubbed internal/db package with a real Postgres layer:
internal/db/db.go: Open() returns a pgxpool.Pool; Migrate() runs embedded migrations via golang-migrate/v4 with the pgx/v5 driver (registered scheme pgx5).
internal/db/migrations/0001_init.{up,down}.sql: placeholder migration to establish the runner. Real schema (artists/albums/tracks/users) lands in 0002 (task #292).
cmd/minstrel/main.go: run db.Migrate then db.Open on startup; defer pool.Close().
go.mod / go.sum: add github.com/jackc/pgx/v5 v5.7.4, github.com/golang-migrate/migrate/v4 v4.18.2. Pinned to versions that still support the go 1.23 toolchain (newer releases require 1.24/1.25).
docker-compose.yml: add minstrel service that depends on healthy postgres and wires SMARTMUSIC_DATABASE_URL.
.env.example: document SMARTMUSIC_* overrides + the opt-in MINSTREL_TEST_DATABASE_URL.
internal/db/db_test.go: env-var-gated real-Postgres test (idempotent Migrate + schema_migrations count). Skipped in -short mode (CI) and when the env var is unset.
Local verification
go vet ./... && gofmt -l . clean.
go test -short -race ./... green (CI-equivalent).
With docker run ... postgres:16-alpine: go test ./... -run TestMigrate green (both migrations applied idempotently).
Smoke test: go run ./cmd/minstrel against the local pg → log migrations applied version=1 dirty=false → curl /healthz → {"status":"ok"}.
CI runner image parity: docker run ... git.fabledsword.com/bvandeusen/runner-base:go-ci bash -c 'golangci-lint run ./... && go test -short -race ./...' green.
Test plan
Forgejo Actions test.yml passes on this PR
Merge → release.yml publishes updated :main image
Server starts cleanly against compose postgres (already verified locally)
Tracks Fable task #291 under milestone 26 (M1 Subsonic baseline).
## Summary
First M1 step — replace the stubbed `internal/db` package with a real Postgres layer:
- `internal/db/db.go`: `Open()` returns a `pgxpool.Pool`; `Migrate()` runs embedded migrations via `golang-migrate/v4` with the `pgx/v5` driver (registered scheme `pgx5`).
- `internal/db/migrations/0001_init.{up,down}.sql`: placeholder migration to establish the runner. Real schema (artists/albums/tracks/users) lands in 0002 (task #292).
- `cmd/minstrel/main.go`: run `db.Migrate` then `db.Open` on startup; defer `pool.Close()`.
- `go.mod` / `go.sum`: add `github.com/jackc/pgx/v5 v5.7.4`, `github.com/golang-migrate/migrate/v4 v4.18.2`. Pinned to versions that still support the `go 1.23` toolchain (newer releases require 1.24/1.25).
- `docker-compose.yml`: add `minstrel` service that depends on healthy `postgres` and wires `SMARTMUSIC_DATABASE_URL`.
- `.env.example`: document `SMARTMUSIC_*` overrides + the opt-in `MINSTREL_TEST_DATABASE_URL`.
- `internal/db/db_test.go`: env-var-gated real-Postgres test (idempotent Migrate + `schema_migrations` count). Skipped in `-short` mode (CI) and when the env var is unset.
## Local verification
- `go vet ./... && gofmt -l .` clean.
- `go test -short -race ./...` green (CI-equivalent).
- With `docker run ... postgres:16-alpine`: `go test ./... -run TestMigrate` green (both migrations applied idempotently).
- Smoke test: `go run ./cmd/minstrel` against the local pg → log `migrations applied version=1 dirty=false` → `curl /healthz` → `{"status":"ok"}`.
- CI runner image parity: `docker run ... git.fabledsword.com/bvandeusen/runner-base:go-ci bash -c 'golangci-lint run ./... && go test -short -race ./...'` green.
## Test plan
- [ ] Forgejo Actions `test.yml` passes on this PR
- [ ] Merge → `release.yml` publishes updated `:main` image
- [ ] Server starts cleanly against compose postgres (already verified locally)
Tracks Fable task #291 under milestone 26 (M1 Subsonic baseline).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
First M1 step — replace the stubbed
internal/dbpackage with a real Postgres layer:internal/db/db.go:Open()returns apgxpool.Pool;Migrate()runs embedded migrations viagolang-migrate/v4with thepgx/v5driver (registered schemepgx5).internal/db/migrations/0001_init.{up,down}.sql: placeholder migration to establish the runner. Real schema (artists/albums/tracks/users) lands in 0002 (task #292).cmd/minstrel/main.go: rundb.Migratethendb.Openon startup; deferpool.Close().go.mod/go.sum: addgithub.com/jackc/pgx/v5 v5.7.4,github.com/golang-migrate/migrate/v4 v4.18.2. Pinned to versions that still support thego 1.23toolchain (newer releases require 1.24/1.25).docker-compose.yml: addminstrelservice that depends on healthypostgresand wiresSMARTMUSIC_DATABASE_URL..env.example: documentSMARTMUSIC_*overrides + the opt-inMINSTREL_TEST_DATABASE_URL.internal/db/db_test.go: env-var-gated real-Postgres test (idempotent Migrate +schema_migrationscount). Skipped in-shortmode (CI) and when the env var is unset.Local verification
go vet ./... && gofmt -l .clean.go test -short -race ./...green (CI-equivalent).docker run ... postgres:16-alpine:go test ./... -run TestMigrategreen (both migrations applied idempotently).go run ./cmd/minstrelagainst the local pg → logmigrations applied version=1 dirty=false→curl /healthz→{"status":"ok"}.docker run ... git.fabledsword.com/bvandeusen/runner-base:go-ci bash -c 'golangci-lint run ./... && go test -short -race ./...'green.Test plan
test.ymlpasses on this PRrelease.ymlpublishes updated:mainimageTracks Fable task #291 under milestone 26 (M1 Subsonic baseline).