Multiple phase transitions shape biodiversity of a migrating population