teleo-infrastructure/docs/reports/leo-working-state-20260709/governance-concept-delete-rollback.sql
twentyOne2x 394a14660d
Some checks are pending
CI / lint-and-test (push) Waiting to run
Add governance concept schema packet
- Create guarded schema and links for governance gates and concept maps
- Prove clone apply and rollback while production schema stays unchanged
- Retain packet docs, state image, and focused tests for apply review

`docs/reports/leo-working-state-20260709/current-truth-index.md`
`docs/reports/leo-working-state-20260709/governance-concept-apply-authorized-commit.sql`
`docs/reports/leo-working-state-20260709/governance-concept-apply-rollback-rehearsal.sql`
`docs/reports/leo-working-state-20260709/governance-concept-clone-rehearsal-current.log`
`docs/reports/leo-working-state-20260709/governance-concept-current.md`
`docs/reports/leo-working-state-20260709/governance-concept-delete-rollback.sql`
`docs/reports/leo-working-state-20260709/governance-concept-packet.json`
`docs/reports/leo-working-state-20260709/governance-concept-postflight.sql`
`docs/reports/leo-working-state-20260709/governance-concept-preflight.sql`
`docs/reports/leo-working-state-20260709/leo-db-state-24-governance-concept-schema.svg`
`docs/reports/leo-working-state-20260709/working-leo-current-state-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-execution-plan-current.md`
`scripts/kb_governance_concept_packet.py`
`tests/test_kb_governance_concept_packet.py`
2026-07-10 00:17:38 +02:00

36 lines
1.1 KiB
PL/PgSQL

\set ON_ERROR_STOP on
-- Emergency rollback for governance/concept generated rows only.
-- Drops generated schema only when the generated tables are empty after row delete.
begin;
delete from public.claim_governance_gate_links
where id in (select id from (values
('1f81e105-af5e-5db8-a7be-08cc6cc4e13a'::uuid),
('af04a87e-c1da-57e9-b11c-60d79daa5648'::uuid)
) as v(id));
delete from public.claim_concept_map_links
where id = 'af4ce1b9-db03-5bde-a21b-0e16ca0f48b8'::uuid;
delete from public.concept_maps
where id = 'f013126c-0937-5bc8-b021-9697e59057d0'::uuid;
do $$
begin
if to_regclass('public.claim_governance_gate_links') is not null
and not exists (select 1 from public.claim_governance_gate_links) then
drop table public.claim_governance_gate_links;
end if;
if to_regclass('public.claim_concept_map_links') is not null
and not exists (select 1 from public.claim_concept_map_links) then
drop table public.claim_concept_map_links;
end if;
if to_regclass('public.concept_maps') is not null
and not exists (select 1 from public.concept_maps) then
drop table public.concept_maps;
end if;
end $$;
commit;