Refactored the migration generator