简体   繁体   中英

Migrations from modules are not executed by yiic migrate command

I am trying to install a user module in my Yii-based application. To do this, I have to migrate the files from:

webapp/protected/modules/user/migrations

I trying to run yiic migrate --migrationPath=user.migrations , but I'm getting an error:

the migration directory does not exist: user.migrations

I read that I have to set up user.migrations as an alias but I don't know how to do it.

I also read, that migration's default folder is determined by basePath value, set in main configuration file ( protected/config/main.php ). I have changed it and it still doesn't work correctly.

What can be wrong?

尝试这个:

yiic migrate --migrationPath=application.modules.user.migrations

from your Command Line open the yiic of your protected folder . Not the yiic of the framework folder .

In case anyone cant seem to make it work, here are some details:

Use: ./yiic migrate --migrationPath=application.dirName.migrations

How come? Check the class MigrateCommand . The public property $migrationPath='application.migrations' where 'application' will become '/home/yourUser/yourYiiApp/protected/ and 'migrations' will become, well 'migrations' after gets parsed. So if you are running ./yiic just point to dirname/migrationFolder

万一其他人对此感到困惑,我必须进入受保护的文件夹,并强制它使用正确的yiic:

php yiic.php migrate --migrationPath=application.modules.user.migrations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM