Constantine Popov
Constantine Popov

Reputation: 58

"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?

Upvotes: 1

Views: 2505

Answers (3)

CreatoR
CreatoR

Reputation: 1652

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');

Upvotes: 1

acorncom
acorncom

Reputation: 5955

Best guess is that migrationPath actually refers to a file system path instead of to an alias like you are using

Upvotes: 0

Ionut Flavius Pogacian
Ionut Flavius Pogacian

Reputation: 4811

maybe this will help:

write something like this within the components array in the console.php config file;

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

and then give the command : php migrate

also, the app/modules/user/migartion folder must exist in this case and must contain migratio files

Upvotes: 0

Related Questions