Summary
Surfaced during work on #499. Three packages share the same write-side
bug — `upsertSQL` writes to a `namespace` column that does not exist
in the `options` table (migration 000008).
Affected files
- `packages/go/settings/postgres.go` — `upsertSQL` and its single caller in `Set`/`SetMany`
- `packages/go/themes/store.go` — same pattern when persisting `active_theme`
- `packages/go/customizer/store.go` — same pattern when persisting overrides
GET path is unaffected; all three select against `key`/`value` only.
Reproduction
- Boot the stack (`docker compose up -d`).
- Sign in as admin.
- Open admin → Settings → General. Change the site name. Save.
Expected: 200, page reloads with new value.
Actual: 500 from `/api/v1/settings` (`column "namespace" does not exist`).
Same reproduces on:
- Appearance → Customize → Save (saves overrides)
- Appearance → Themes → switch active theme
Recommended fix
Either:
(a) Add a `namespace` column to the `options` table via a new migration. Default to `''` for existing rows. Update the GET path's WHERE clauses to filter by namespace too. Riskier — broadens the schema.
(b) Strip the `namespace` column from the three `upsertSQL` statements. The current code never populates it from anything but a hardcoded constant. Cheapest fix; matches the schema as it ships.
Recommend (b) for now. Re-evaluate when multi-tenant work lands.
Acceptance
- Each Settings sub-page "Save" button persists and reloads with the saved value.
- `go test ./packages/go/settings/...` covers a Set→Get round-trip.
Summary
Surfaced during work on #499. Three packages share the same write-side
bug — `upsertSQL` writes to a `namespace` column that does not exist
in the `options` table (migration 000008).
Affected files
GET path is unaffected; all three select against `key`/`value` only.
Reproduction
Expected: 200, page reloads with new value.
Actual: 500 from `/api/v1/settings` (`column "namespace" does not exist`).
Same reproduces on:
Recommended fix
Either:
(a) Add a `namespace` column to the `options` table via a new migration. Default to `''` for existing rows. Update the GET path's WHERE clauses to filter by namespace too. Riskier — broadens the schema.
(b) Strip the `namespace` column from the three `upsertSQL` statements. The current code never populates it from anything but a hardcoded constant. Cheapest fix; matches the schema as it ships.
Recommend (b) for now. Re-evaluate when multi-tenant work lands.
Acceptance