Yii 1.1: smigrationcommand

Module Wise Migration

This is an extension of base Migration Command to provide functionality to have migrations in modules and apply/undo those migrations modules wise.


Yii 1.1


  1. Put the SMigrationCommand.php file to ~protected/commands folder.
  2. add below snippet to ~config/console.php.
return array(
'commandMap' => array(
        'migrate' => array(
            'class' => 'application.commands.SMigrationCommand',

Always put normal migration scripts in ~protected/migrations folder and module migrations in ~protected/modules/nameofmodule/migrations.

now open CMD/terminal CD to ~protected. invoke command yiic migrate [up|down] [...] for normal migrations AND yiic migrate module <module_name> [up|down] [...] for module migrations

Only migrate create,migrate up and migrate down is working currently. Will upgrade gradually.



Total 1 comment

#17122 report it
Chandrakanta at 2014/05/05 02:17pm
If you already have migrations

You can set up this two way.. migrate all your migration down and do migration up. or add an extra column named module to the tbl_migration table or any other tables that holds the migration applied information.

Leave a comment

Please to leave your comment.

Create extension