Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii automatic db migrations

I have setup my first db migration using the built in migration tools of yii, and locally i can run

./yiic migrate

I can see it say "this migration needs to run" and press Y and it runs and works fine.

When i deploy my site, I can automatically run that command but not pass the Y

Is there a command or url i can hit to upgrade the db without logging in and pressing Y?

like image 980
Wizzard Avatar asked Oct 18 '11 18:10

Wizzard


2 Answers

Yes, use the command: ./yiic migrate --interactive=0 and it will run without prompting you.

See http://www.yiiframework.com/doc/guide/1.1/en/database.migration#use-command-line-options for more details.

like image 61
ajsharma Avatar answered Oct 18 '22 04:10

ajsharma


For some reason this wasn't working in 1.1.8, so i added the following to the console config file.

'commandMap'=> array(
    'migrate'=> array(
      'class'=>'system.cli.commands.MigrateCommand',
      'interactive'=> 0,
    ),
),
like image 26
Chris Herring Avatar answered Oct 18 '22 05:10

Chris Herring