feat(postgres): port events/identities/status surfaces, fix shipped defects
CHECKPOINT -- the full State Store port is in progress; this lands the compile-clean core so the review pass has a diff to work against. Remaining: advisory-lock ownership, event-insert serialization, maintenance, and the ported test battery. Two corrections to behaviour that already shipped, not new features: - UpdateTask wrote park_reason raw where SQLite applies clip(park_reason, 4000); the PostgreSQL adapter now clips before binding (clip.go). - tasks.review_cursor existed on the protobuf wire and in workflow.Task but not in the PostgreSQL schema; 0004 adds it as a NEW migration rather than amending 0001 because a dev database may already have applied 0001 and goose tracks version numbers, not checksums. Also moves the control-plane Resource/ResourceWrite types and their sentinels into storecontract so the postgres package can stop importing internal/store (they stay aliased there for daemon callers).
This commit is contained in:
17 files changed
+2424
-29
No files matched your search
@@ -0,0 +1,44 @@
|
||||
-- Status projection queries: the published configuration snapshot and the
|
||||
-- channel / apply-status runtime reports the UI reads across the State Store
|
||||
-- boundary.
|
||||
|
||||
-- name: UpsertConfigSnapshot :exec
|
||||
INSERT INTO config_snapshot (id, schema, document, published_at)
|
||||
VALUES (1, $1, $2, $3)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
schema = excluded.schema,
|
||||
document = excluded.document,
|
||||
published_at = excluded.published_at;
|
||||
|
||||
-- name: ConfigSnapshotByID :one
|
||||
SELECT schema, document, published_at FROM config_snapshot WHERE id = 1;
|
||||
|
||||
-- name: UpsertChannelStatus :exec
|
||||
INSERT INTO channel_status (id, name, state, detail, configured, reload_supported, observed_at)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
name = excluded.name,
|
||||
state = excluded.state,
|
||||
detail = excluded.detail,
|
||||
configured = excluded.configured,
|
||||
reload_supported = excluded.reload_supported,
|
||||
observed_at = excluded.observed_at;
|
||||
|
||||
-- name: DeleteChannelStatusNotIn :exec
|
||||
DELETE FROM channel_status WHERE NOT (id = ANY($1::text[]));
|
||||
|
||||
-- name: ListChannelStatus :many
|
||||
SELECT id, name, state, detail, configured, reload_supported, observed_at
|
||||
FROM channel_status ORDER BY id;
|
||||
|
||||
-- name: UpsertApplyStatus :exec
|
||||
INSERT INTO apply_status (process, kind, applied_version, error, reported_at)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
ON CONFLICT (process, kind) DO UPDATE SET
|
||||
applied_version = excluded.applied_version,
|
||||
error = excluded.error,
|
||||
reported_at = excluded.reported_at;
|
||||
|
||||
-- name: ListApplyStatus :many
|
||||
SELECT process, kind, applied_version, error, reported_at
|
||||
FROM apply_status ORDER BY process, kind;
|
||||
Reference in new issue
Block a user