bariew / yii2-module-migration-controller
Runs module migrations from module 'migrations' folder
Installs: 3 943
Dependents: 5
Suggesters: 0
Security: 0
Stars: 9
Watchers: 6
Forks: 4
Open Issues: 1
Type:yii2-extension
This package is auto-updated.
Last update: 2024-10-16 15:09:36 UTC
README
Runs module migrations from module 'migrations' folder. Use it if you want to keep your module migrations inside module 'migrations' folder.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist bariew/yii2-module-migration-controller "*"
or add
"bariew/yii2-module-migration-controller": "*"
to the require section of your composer.json
file.
Usage
Redefine migrate controller in your console config file:
...
'controllerMap' => [
'migrate' => 'bariew\moduleMigration\ModuleMigrateController'
],
...
Also define 'modules' app attribute here like in web app config file, e.g.:
...
'modules' => [
'user' => 'app\modules\user\Module',
'page' => [
'class' => 'app\modules\base\modules\Module'
]
],
migrations from your moduleFolder/migrations will be applied.
Since 1.3.0 there is also migrate/data-dump {tableName} action - for generating any table data migration into @app/migrations folder.
Since 1.2.0 you may use new commands:
./yii migrate/module-up yourModuleName
./yii migrate/module-down yourModuleName