EU ministers seal ‘historic’ migration deal