refactoring create migration logic