common/config/main.php
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
],
'bootstrap' => [
'user-manager',
],
'modules' => [
'user-manager' => [
'class' => 'common\modules\UserManager\Module',
'plugins' => ['profile'],
],
],
'controllerMap' => [
'migrate-app' => [
'class' => 'yii\console\controllers\MigrateController',
//'migrationNamespaces' => [''],
'migrationTable' => 'migration',
],
],
];
common/modules/UserManager/Module.php
class Module extends \yii\base\Module
{
public $plugins = [];
/**
* @inheritdoc
*/
public $controllerNamespace = 'common\modules\UserManager\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$plugins = [];
if(isset($this->plugins) && !empty($this->plugins)){
$this->plugins = array_flip($this->plugins);
if(isset($this->plugins['profile'])){
$plugins['profile'] = [
'class' => 'common\modules\UserManager\modules\Profile\Module'
];
}
}
$this->modules = $plugins;
if(\Yii::$app instanceof \yii\console\Application){
$migName[] = 'common\modules\UserManager\migrations';
if(isset($this->plugins['profile'])){
$migName[] = 'common\modules\UserManager\modules\Profile\migrations';
}
\Yii::$app->controllerMap['migrate-user-manager'] = [
'class' => 'yii\console\controllers\MigrateController',
'migrationNamespaces' => $migName,
'migrationTable' => 'migration_user_manager',
];
}
}
}
При команде в консоли:
./yii migrate-user-manager
Yii предлогает исполнить все миграции и даже те которые не указаны для данной команды.
Yii Migration Tool (based on Yii v2.0.11.2)
Total 3 new migrations to be applied:
m130524_201442_init
common\modules\UserManager\migrations\m170424_124532_user_manager_init
common\modules\UserManager\modules\Profile\migrations\m170502_154236_user_manager_profile
Apply the above migrations? (yes|no) [no]:n
Почему так происходит и как это исправить?