Make migration rollbacks robuster to bad state