feat(postgres): State Store schema and sqlc queries, with the claim path proven on PG 18

goose migration 0001 lands the twelve State Store tables on Postgres, and sqlc generates the task queries from it. Two behaviours that genuinely differ from SQLite are pinned by tests against a real PG 18: claiming takes the oldest queued row with FOR UPDATE SKIP LOCKED (without the clause a second claimer blocks, which the test shows by timing out), and every column behind a Go int is bigint -- SQLite's INTEGER is 64-bit, and the chat issue-number allocator seeds at 10^15, which does not fit an int4.

task db:generate writes the committed postgresdb package; task db:check regenerates it in the gate, as proto:check and ui:check do.

The remaining store methods (events, resources, identities, the status tables) still run on SQLite: porting them is the rest of archie-core-7r0x.2.
This commit is contained in:
sam committed 2026-09-24 01:18:19 +10:00
1 parent c6df4b4a54
commit a69f9c81c2
11 files changed
+1408

No files matched your search

+17
View File
@@ -53,6 +53,22 @@ tasks:
cmds:
- bash tools/proto.sh lint
db:generate:
desc: "Regenerate the sqlc query code from the schema and query files"
summary: |
Writes internal/infrastructure/postgres/postgresdb. The output is
committed, so this dirties the tree deliberately: review the diff and
commit it with the schema or query change that caused it. Never
hand-edit the generated package.
cmds:
- go -C tools tool sqlc generate -f {{.ROOT_DIR}}/internal/infrastructure/postgres/sqlc.yaml
db:check:
desc: "Regenerate the sqlc code and reject uncommitted generated differences"
cmds:
- task: db:generate
- git diff --exit-code -- internal/infrastructure/postgres/postgresdb
proto:check:
desc: Regenerate contracts and reject uncommitted generated differences
cmds:
@@ -507,6 +523,7 @@ tasks:
# after them only reads it, so it runs concurrently.
- task: fmt
- task: proto:check
- task: db:check
- task: check:readonly
check:readonly: