Make migration robust to model changes