--- alter-clients-crm-unique-index
DROP INDEX IF EXISTS clients_crm_id_crm_client_id_uniq;

CREATE UNIQUE INDEX IF NOT EXISTS clients_project_id_crm_id_crm_client_id_uniq
  ON clients (crm_id, crm_client_id, project_id)
  WHERE crm_id IS NOT NULL AND crm_client_id IS NOT NULL;

ALTER TABLE clients DROP uid;