fix(archied): post each reportable status a chat task reaches, recorded by status not by flag

This commit is contained in:
sam committed 2026-10-25 02:42:31 +11:00
1 parent 1a386dae7e
commit 4e2edc911f
13 files changed
+85 -51

No files matched your search

@@ -0,0 +1,18 @@
-- A chat task's conversation is told about each state worth reporting (an
-- approval request, an open pull request, a final outcome). Recording which
-- status was posted, rather than whether anything was, makes every status
-- change due for posting without each write path having to reset a flag.
-- +goose Up
ALTER TABLE tasks ADD COLUMN outcome_posted_status text NOT NULL DEFAULT '';
UPDATE tasks SET outcome_posted_status = status WHERE outcome_posted;
DROP INDEX IF EXISTS idx_tasks_outcome_unposted;
ALTER TABLE tasks DROP COLUMN outcome_posted;
CREATE INDEX idx_tasks_outcome_unposted ON tasks (id) WHERE origin <> '' AND outcome_posted_status <> status;
-- +goose Down
DROP INDEX IF EXISTS idx_tasks_outcome_unposted;
ALTER TABLE tasks ADD COLUMN outcome_posted boolean NOT NULL DEFAULT false;
UPDATE tasks SET outcome_posted = outcome_posted_status = status;
ALTER TABLE tasks DROP COLUMN outcome_posted_status;
CREATE INDEX idx_tasks_outcome_unposted ON tasks (id) WHERE origin <> '' AND NOT outcome_posted;