simplator/yii2-migrate-command

This package is abandoned and no longer maintained. No replacement package was suggested.

Console Migration Command with multiple paths/aliases support

Installs: 120

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 16

Type:yii2-extension

0.2.1 2015-07-05 17:02 UTC

This package is not auto-updated.

Last update: 2018-07-18 18:02:48 UTC


README

Console Migration Command with multiple paths/aliases support

This extension was created from this Pull Request on GitHub, which became unmergeable. Until this feature will be reimplemented into the core, you can use this extension if you need to handle multiple migration paths.

Note! If using dmstr/yii2-migrate-command in an existing project, you may have to remove your migration table, due to a schema change.

Installation

The preferred way to install this extension is through composer.

php composer.phar require dmstr/yii2-migrate-command "*"

Usage

Configure the command in your main application configuration:

'controllerMap'       => [
    'migrate' => [
        'class' => 'dmstr\console\controllers\MigrateController'
    ],
],

Once the extension is installed and configured, simply use it on your command line

./yii migrate

Adding migrations via application configuration

Add additional migration paths via application params:

"yii.migrations"=> [
    "@dektrium/user/migrations",
],

Adding migrations via extension bootstrap()

You can also add migrations in your module bootstrap process:

public function bootstrap($app)
{
    $app->params['yii.migrations'][] = '@vendorname/packagename/migrations';
}

Adding migrations via command parameter

If you want to specify an additional path directly with the command, use

./yii migrate --migrationLookup=@somewhere/migrations/data1,@somewhere/migrations/data2

Note! Please make sure to not use spaces in the comma separated list.