Fix migration history issues