KB-6C44

Axis Rollout SQL G_prod_03 — Production Rollout Rollback (reversal; sha256 bc97a185…)

2 min read Revision 1
one-roofaxis-substrateproduction-rolloutsqlrollbackreversal

-- ============================================================================ -- G_prod_03 — PRODUCTION AXIS ROLLOUT ROLLBACK (reverses G_prod_01 fully) -- Run on production directus ONLY if rollout must be undone. The axis -- substrate is additive (no pre-existing table was ALTERed), so dropping it -- restores production exactly to its pre-rollout state (gap 210, ownership 0). -- ============================================================================ \set ON_ERROR_STOP on BEGIN; DO $$ DECLARE v_db text; BEGIN SELECT current_database() INTO v_db; IF v_db <> 'directus' THEN RAISE EXCEPTION 'REFUSING: % not production directus', v_db; END IF; END $$;

DROP VIEW IF EXISTS v_axis_coverage_gap; DROP VIEW IF EXISTS v_axis_effective_owner; DROP VIEW IF EXISTS v_axis_required_cell; DROP TABLE IF EXISTS axis_candidate_finding; DROP TABLE IF EXISTS axis_object_ownership; DROP TABLE IF EXISTS axis_assignment; DROP TABLE IF EXISTS coverage_rule; DROP TABLE IF EXISTS axis_value; DROP TABLE IF EXISTS axis_registry;

DO $$ DECLARE n int; BEGIN SELECT count() INTO n FROM information_schema.tables WHERE table_schema='public' AND table_name IN ('axis_registry','axis_value','axis_assignment','coverage_rule','axis_object_ownership','axis_candidate_finding'); IF n<>0 THEN RAISE EXCEPTION 'ROLLBACK incomplete: % tables remain', n; END IF; RAISE NOTICE 'ROLLBACK OK: axis substrate removed; production restored (gap 210, ownership 0).'; END $$; COMMIT; SELECT (SELECT count() FROM v_object_owner_gap) AS canonical_gap_restored, (SELECT count(*) FROM governance_object_ownership) AS ownership_rows;

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-nonprod-clone-axis-topic-substrate-pipeline-2026-06-02/sql/G_prod_03_rollback.sql