-- =============================================================================
-- Migration: Disable OutboxPoller to reduce database load
-- Description: Drop NOTIFY trigger on audit_outbox to prevent real-time wake-up
-- Reason: OutboxPoller polling at 100ms interval causing database locks and slow login
--          Dropping trigger reduces poll frequency from 100ms to 10s (fallback)
-- Impact: Audit events will still be processed but with 10s delay instead of real-time
-- Rollback: Recreate trigger to restore real-time processing
-- =============================================================================

-- Drop trigger to disable real-time NOTIFY
DROP TRIGGER IF EXISTS trigger_notify_outbox ON audit.audit_outbox;

-- Verify trigger is dropped
SELECT 
    trigger_name,
    event_manipulation,
    event_object_table
FROM 
    information_schema.triggers
WHERE 
    trigger_name = 'trigger_notify_outbox';

-- Expected result: 0 rows (trigger dropped)

-- =============================================================================
-- ROLLBACK (if needed):
-- CREATE TRIGGER trigger_notify_outbox
--     AFTER INSERT ON audit.audit_outbox
--     FOR EACH STATEMENT
--     EXECUTE FUNCTION audit.notify_outbox_insert();
-- =============================================================================
