Migration Command for large project

If you work on large scale project, in big team, eventually you’ll have tons of migrations. And, all of them are in one folder. When you open that folder in any IDE, you have to scroll some time, before reaching latest migrations (for fixing something, or something else).

So, this bugged me to the point I had to extend this command, and make few changes. I only changed logic of where new migration file will be created.

With default setting, this is how it works:

If there is less then 10 (number of files can be easily changed) migration files, everything is as it was. If you create 11th migration, new folder names "old" (also can be changed) is created, and first migration is moved to it. So, in your migrations folder you only see latest 10 migrations, and folder with older ones.

If you want to use this code in your console config file:




'commandMap' => array(

    'migrate' => array(

        'class' => 'application.commands.EnhancedMigrateCommand',

    ),

),



If you have any remark, please write :)

and how can this help in large project? :expressionless:

can’y you just sort files by name descending… ?

Well, I’m using netbeans, for example. We have over 350 migrations. And, there is no option for sorting these files in netbeans file manager. Or in eclipse, as far as I know. Imagine scrolling down over that many files. This way you see your migration right away. Old migrations, that are hidden, are probably already executed so I assume you won’t change them.

Anyway, I just meant to help handling your migration files.