Download the PHP package nkovacs/migrate-command without Composer
On this page you can find all versions of the php package nkovacs/migrate-command. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nkovacs/migrate-command
More information about nkovacs/migrate-command
Files in nkovacs/migrate-command
Package migrate-command
Short Description This is an enhanced version of the Yii Database Migration Tool that adds module support and many more usefull features.
License BSD-3-Clause
Homepage https://github.com/yiiext/migrate-command
Informations about the package migrate-command
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 github 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:
Please note: if you already used MigrateCommand before, make sure to add the module column to your migrationTable:
Usage
General Usage
You can run yiic migrate help
to see all parameters and a short example on how to use them.
The basics are explained in the Definitive Guide to Yii. Read them first if you haven't used database migration before. The usage of Extended Migration Command is not much different from the native one. The only command that is different is create where you have to additionally specify the modulename:
This creates a new migration named 'create_user_table' in module 'modulename'. The native usage
creates a new migration named 'create_user_table' in the application(core).
--module Parameter
In all other commands (up
, down
, history
, new
, to
and mark
) you can use the parameter --module=<modulenames>
where <modulenames>
can be a comma seperated list of module names or a single module name. This parameter will limit the current command to affect only the specified modules.
Some Examples:
This will show you all new migrations for module core and
will migrate up the next 5 new migrations in modules core and user. If there are new migrations in other modules they will be ignored.
will show you which migrations have been applied for modules core and user in the past. If you do not specify a module the command behaves like the native one and does the migration for all modules.
add a module
Simply enable it in your config and run yiic migrate up --module=yourModule
.
remove a module
Run yiic migrate to m000000_000000 --module=yourModule
. For this to work all your migrations must have the down()-method implemented correctly.