CREATE INDEX IF NOT EXISTS idx_media_quality_upgrade
ON media (monitored, media_type)
WHERE monitored = true AND deleted_at IS NULL
  AND current_quality IS NOT NULL
  AND desired_quality IS NOT NULL;
