yiic migrate命令不会执行模块迁移
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 bybasePath
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?
我正在尝试在基于Yii的应用程序中安装用户模块。 为此,我必须从以下位置迁移文件: p>
webapp / protected / modules / user / migrations
code> pre>
我试图运行 yiic migrate --migrationPath = user.migrations code>,但是我收到一个错误: p>
迁移目录没有 存在:user.migrations
code> pre>
我读到我必须将user.migrations设置为别名,但我不知道该怎么做。 p >
我还读到,迁移的默认文件夹由 basePath code>值决定,在主配置文件中设置( protected / config / main.php code>) 。 我已经改变了它仍然无法正常工作。 p>
可能出现什么问题? p>
div>
Try this:
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
In case anyone else is struggling with this, I had to go into the protected folder and force it to use the right yiic with:
php yiic.php migrate --migrationPath=application.modules.user.migrations