Migration CLI fixes for catching DB errors and huge records