Move some codes from Migration class to Cli class