-- ADR-090-D rollback: remove Ansible executor audit states from operation_type allowlist.
-- Only apply after confirming no automation_operation_log rows use ansible_* operation types.

ALTER TABLE automation_operation_log
    DROP CONSTRAINT IF EXISTS automation_operation_log_type_valid;

ALTER TABLE automation_operation_log
    ADD CONSTRAINT automation_operation_log_type_valid CHECK (operation_type IN (
        'monitor_configured','monitor_removed',
        'alert_fired','alert_suppressed','alert_routed',
        'rule_created','rule_updated','rule_matched','rule_rejected','rule_deprecated',
        'playbook_generated','playbook_updated','playbook_executed',
        'remediation_executed','remediation_verified','remediation_rolled_back',
        'self_correction_attempted',
        'km_created','km_updated','km_linked',
        'asset_discovered','coverage_recalculated',
        'capacity_recommendation','quota_enforced',
        'notification_formatted'
    ));
