Files
buzz/migrations/0042_host_execution_fts.sql
Logan Johnson 19e3b25b76 feat(hosts): add opt-in durable remote Start for provisioned executors
Keep Start off by default. Admit owner-private encrypted command and receipt transport, fence immutable retries, and expose provisioned destination selection. Exercise two isolated native executors through spawn, signed receipt, live run label, and source restart; no physical-host or real-model certification.

Signed-off-by: Logan Johnson <loganj@squareup.com>
2026-08-31 16:40:37 -04:00

27 lines
949 B
SQL

-- Private execution commands and receipts must not be indexed. Same heap-rewrite operational
-- cost as 0033: schedule a maintenance window for large databases.
DO $$
DECLARE
existing_expression TEXT;
BEGIN
SELECT pg_get_expr(d.adbin, d.adrelid)
INTO existing_expression
FROM pg_attrdef d
JOIN pg_attribute a
ON a.attrelid = d.adrelid
AND a.attnum = d.adnum
WHERE d.adrelid = 'events'::regclass
AND a.attname = 'search_tsv';
IF existing_expression IS NULL THEN
RAISE EXCEPTION 'events.search_tsv generated expression not found';
END IF;
ALTER TABLE events DROP COLUMN search_tsv;
EXECUTE format(
'ALTER TABLE events ADD COLUMN search_tsv TSVECTOR GENERATED ALWAYS AS (CASE WHEN kind IN (50001, 50002) THEN NULL::tsvector ELSE (%s) END) STORED',
existing_expression
);
CREATE INDEX idx_events_search_tsv ON events USING GIN (search_tsv);
END $$;