-- Corrige políticas cadastradas para o destino errado (C6 código 336 em vez de 626)
SET @old_destination_id := (
    SELECT id
    FROM bank_catalog
    WHERE code = '336'
    LIMIT 1
);

SET @new_destination_id := (
    SELECT id
    FROM bank_catalog
    WHERE code = '626'
    LIMIT 1
);

UPDATE bank_portability_policies
SET bank_destination_id = @new_destination_id
WHERE @old_destination_id IS NOT NULL
  AND @new_destination_id IS NOT NULL
  AND bank_destination_id = @old_destination_id;

