-- Normalize all existing lead interests to lowercase for consistent matching -- This fixes the case sensitivity issue between lead interests and provider categories -- Update all existing leads to have lowercase interests UPDATE leads SET interests = ( SELECT array_agg(lower(trim(interest))) FROM unnest(interests) AS interest ) WHERE interests IS NOT NULL; -- Add a comment explaining the normalization COMMENT ON COLUMN leads.interests IS 'Array of interest tags (stored in lowercase for case-insensitive matching)';