How to handle yii2 migrations on hosts without console access?
I've succesfully created and uploaded advanced template on my shared host.
As next step, I must run the yii migrate
.
But I cannot because I've not the console access.
What could you suggest to me?
Please note that
permissione denied
when trying to run yii migrate --interactive=0
I tried also this: added an actionMigrateUp to frontend/controllers/siteController.php
public function actionMigrateUp()
{
// https://github.com/yiisoft/yii2/issues/1764#issuecomment-42436905
$oldApp = Yii::$app;
new yiiconsoleApplication([
'id' => 'Command runner',
'basePath' => '@app',
'components' => [
'db' => $oldApp->db,
],
]);
Yii::$app->runAction('migrate/up', ['migrationPath' => '@console/migrations/', 'interactive' => false]);
Yii::$app = $oldApp;
}
But when I visit /frontend/web/index.php?r=site/migrateUp
I got a 404
exception 'yiibaseInvalidRouteException' with message 'Unable to resolve the request: site/migrateUp' in C:xampphtdocswwwvendoryiisoftyii2baseController.php:122
The action that you have created is not accesible with
/frontend/web/index.php?r=site/migrateUp
but with
/frontend/web/index.php?r=site/migrate-up
Otherwise everything should be fine.
I found this answer: How to run Yiic from your Yii application without shelling out to the console
You need to run: yiic migrate --interactive=0
or php yii migrate --interactive=0