Search code examples
phpyiicomposer-phpyii-extensionsyii-migrations

"migration directory does not exist" error when running Yii-user extension's migrations


I have a Yii framework installed by Composer, webapp in public_html folder and all libraries in vendor folder:

webroot
|
|_public_html
|
|_vendor
  |
  |_fierwebdesign
    |
    |_yii-user
      |
      |_migrations

My configuration in console.php is:

'modules'=>array(
  'user'=>array(
     'hash' => 'md5',
      'sendActivationMail' => true,
      'loginNotActiv' => false,
      'activeAfterRegister' => false,
      'autoLogin' => true,
      'registrationUrl' => array('/user/registration'),
      'recoveryUrl' => array('/user/recovery'),
      'loginUrl' => array('/user/login'),
      'returnUrl' => array('/user/profile'),
      'returnLogoutUrl' => array('/user/login'),
    ),
),

When I try to run Yii-user extension's migrations, I'm getting error:

yiic.php migrate --migrationPath=vendor.fierwebdesign.yii-user.migrations

Error: The migration directory does not exist: vendor.fierwebdesign.yii-user.migrations

What am I doing wrong?


Solution

  • You need declare vendor alias in configs. If your console.php in public_html/config/ than declaration is:

    Yii::setPathOfAlias('vendor', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' .
                   DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_vendor');