Answer the question
In order to leave comments, you need to log in
Can I run yiic migrate and other standard commands in CConsoleCommand in Yii?
I tried it through exec , it hangs for a long time, creates the migrations table and hangs for a long time, I don’t know how long, I didn’t wait.
I would like to perform the migration and have the output also displayed as when migrating in the usual way
Command example:
class DeployCommand extends CConsoleCommand {
public function actionIndex() {
exec('yiic migrate'); // это нельзя как-нибудь средствами фреймворка сделать?
}
}
Answer the question
In order to leave comments, you need to log in
Happened
protected function applyMigrations() {
Yii::import('system.cli.commands.MigrateCommand');
$command = new MigrateCommand('migrate', new CConsoleCommandRunner);
$command->run(['up']);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question