Extended Migration Command
This extension is an enhanced version of the Yii Database Migration Tool that adds module support and many more usefull features. If there is anything you would like to have added, or you found a bug please report it on google code or contact me via email.
Features
- Module-Support (migrations are distributed in a seperate folder for every module) so you can...
- ...enable and disable Modules
- ...add new module by migrating it up
- ...remove a module by running its migrations down
- ...select the modules you want to run migrations for in every run
- ...declare Module-dependencies (coming soon)
- ...different migration templates depending on modules (coming soon)
Resources
Requirements
- Yii 1.1.6 or above (MigrateCommand was introduced in this version) if you copy MigrateCommand and CDbMigration you should be able to use this extension with any yii version.
Installation
- Extract the release file under
protected/extensions. - Add the following to your config file for yiic command:
'commandMap' => array( 'migrate' => array( // alias of the path where you extracted the zip file 'class' => 'application.extensions.yiiext.commands.migrate.EMigrateCommand', // this is the path where you want your core application migrations to be created 'migrationPath' => 'application.db.migrations', // the name of the table created in your database to save versioning information 'migrationTable' => 'tbl_migration', // the application migrations are in a pseudo-module called "core" by default 'applicationModuleName' => 'core', // define all available modules 'modulePaths' => array( 'admin' => 'application.modules.admin.db.migrations', 'user' => 'application.modules.user.db.migrations', 'yourModule' => 'application.any.other.path.possible', // ... ), // here you can configrue which modules should be active, you can disable a module by adding its name to this array 'disabledModules' => array( 'admin', 'anOtherModule', // ... ), // the name of the application component that should be used to connect to the database 'connectionID'=>'db', // alias of the template file used to create new migrations 'templateFile'=>'application.db.migration_template', ), ),
Please note: if you already used MigrateCommand before, make sure to add the module column to your migrationTable:
ALTER TABLE `tbl_migration` ADD COLUMN `module` varchar(32) DEFAULT NULL; UPDATE `tbl_migration` SET module='core';
Usage
- run
yiic migrate helpto see all parameters and how to use them - some more documentation and usage examples will be provided here in a few days
© 2009 — 2011, yiiext team.