godcrm/scripts/phase6-6.5-docs-status-regressed-published.rollback.sql
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

24 lines
806 B
PL/PgSQL

-- Rollback for phase6-6.5-docs-status-regressed-published.sql.
-- Removes the 'regressed-published' option from widget 218 registry
-- status column. Any doc rows currently holding that status will keep
-- the literal string value — reassign them (e.g. back to 'draft') BEFORE
-- running this rollback, otherwise the select cell renders as unknown.
BEGIN;
UPDATE table_columns
SET config = jsonb_set(
config::jsonb,
'{options}',
(
SELECT jsonb_agg(opt)
FROM jsonb_array_elements(config::jsonb -> 'options') AS opt
WHERE opt ->> 'value' <> 'regressed-published'
)
)::text,
updated_at = CURRENT_TIMESTAMP
WHERE table_id = 2197
AND column_name = 'status'
AND (config::jsonb -> 'options') @> '[{"value":"regressed-published"}]'::jsonb;
COMMIT;