-- Rollback for AwoooP RLS Canary Wave 1.
-- This only removes the wave1 policies and disables RLS on the canary tables.
-- It intentionally does not touch data.

BEGIN;

SET LOCAL lock_timeout = '5s';
SET LOCAL statement_timeout = '30s';

DROP POLICY IF EXISTS awooop_contract_revisions_tenant ON awooop_contract_revisions;
ALTER TABLE awooop_contract_revisions NO FORCE ROW LEVEL SECURITY;
ALTER TABLE awooop_contract_revisions DISABLE ROW LEVEL SECURITY;

DROP POLICY IF EXISTS awooop_conversation_event_tenant ON awooop_conversation_event;
ALTER TABLE awooop_conversation_event NO FORCE ROW LEVEL SECURITY;
ALTER TABLE awooop_conversation_event DISABLE ROW LEVEL SECURITY;

DROP POLICY IF EXISTS awooop_mcp_credential_refs_tenant ON awooop_mcp_credential_refs;
ALTER TABLE awooop_mcp_credential_refs NO FORCE ROW LEVEL SECURITY;
ALTER TABLE awooop_mcp_credential_refs DISABLE ROW LEVEL SECURITY;

DROP POLICY IF EXISTS awooop_mcp_gateway_audit_tenant ON awooop_mcp_gateway_audit;
ALTER TABLE awooop_mcp_gateway_audit NO FORCE ROW LEVEL SECURITY;
ALTER TABLE awooop_mcp_gateway_audit DISABLE ROW LEVEL SECURITY;

DROP POLICY IF EXISTS awooop_mcp_grants_tenant ON awooop_mcp_grants;
ALTER TABLE awooop_mcp_grants NO FORCE ROW LEVEL SECURITY;
ALTER TABLE awooop_mcp_grants DISABLE ROW LEVEL SECURITY;

DROP POLICY IF EXISTS budget_ledger_tenant ON budget_ledger;
ALTER TABLE budget_ledger NO FORCE ROW LEVEL SECURITY;
ALTER TABLE budget_ledger DISABLE ROW LEVEL SECURITY;

COMMIT;
