https://github.com/dmstr/yii2-migrate-command
Console Migration Command for Yii 2.0 with multiple paths/aliases support
https://github.com/dmstr/yii2-migrate-command
Last synced: 12 months ago
JSON representation
Console Migration Command for Yii 2.0 with multiple paths/aliases support
- Host: GitHub
- URL: https://github.com/dmstr/yii2-migrate-command
- Owner: dmstr
- Created: 2014-07-03T00:16:35.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-09-06T12:06:12.000Z (almost 9 years ago)
- Last Synced: 2025-05-04T03:02:46.855Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 31
- Watchers: 8
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Extended Migration Command
==========================
**DEPRECATION NOTICE - since Yii 2.0.12 this extension is obsolete, its functionality is now supported by the framework core.** For details see also [issue](https://github.com/dmstr/yii2-migrate-command/issues/23#issuecomment-326950039).
---
[](https://packagist.org/packages/dmstr/yii2-migrate-command)
[](https://packagist.org/packages/dmstr/yii2-migrate-command)
[](https://packagist.org/packages/dmstr/yii2-migrate-command)
Console Migration Command with multiple paths/aliases support
This extension was created from this [Pull Request](https://github.com/yiisoft/yii2/pull/3273) 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](http://getcomposer.org/download/).
```
composer 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.
---
Built by [dmstr](http://diemeisterei.de), Stuttgart