This is an extension of base Migration Command to provide functionality to have migrations in modules and apply/undo those migrations modules wise.
- Put the SMigrationCommand.php file to ~protected/commands folder.
- 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 [up|down] [...] for module migrations
Only migrate create,migrate up and migrate down is working currently. Will upgrade gradually.
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.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.