Rocky super-Earths or waterworlds: the interplay of planet migration, pebble accretion, and disc evolution