1

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?

4

3 回答 3

1

您需要在配置中声明vendor别名。如果您的console.php 在public_html/config/声明中是:

Yii::setPathOfAlias('vendor', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' .
               DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_vendor');
于 2013-10-30T22:38:42.563 回答
0

也许这会有所帮助:

在配置文件的components数组中写这样的东西;console.php

    'commandMap' => array(
        'migrate' => array(
            'class' => 'system.cli.commands.MigrateCommand',
            'migrationPath' => 'application.modules.user.migrations',
//            'migrationTable' => 'tbl_migration',
            'connectionID' => 'db',
//            'templateFile' => 'application.migrations.template',
        ),

然后给出命令:php migrate

此外,app/modules/user/migartion在这种情况下,该文件夹必须存在并且必须包含迁移文件

于 2013-10-30T13:05:26.820 回答
0

最好的猜测是它migrationPath实际上是指文件系统路径,而不是像您正在使用的别名

于 2013-10-30T18:53:01.910 回答