-- Migration 135: Equivalence quality cleanup
-- Demotes auto_approved rows that no longer meet quality gates:
-- 1. FX product has no standard_name → can't verify match quality
-- Applied 2026-07-11 after adding standard_name gate to catalog-reconcile.

UPDATE transceiver_equivalences e
SET status = 'pending', updated_at = NOW()
FROM transceivers fx
WHERE e.flexoptix_id = fx.id
  AND e.status = 'auto_approved'
  AND fx.standard_name IS NULL;

-- Result: 60,278 demoted from auto_approved → pending
-- Remaining auto_approved: 20,838 (all with standard_name)
