/** * Migrations perform * * @param array $config * @return array */ public function migrate($config = []) { $migrator = new Migrator($config); $migrations = $migrator->migrate(); if (is_object($migrator->error)) { return ['error' => $migrator->error->getMessage()]; } else { return ['migrations' => $migrations]; } }
public function actionApplyMigrations() { if (Yii::$app->request->isAjax) { $migrator = new Migrator(); $migrator->migrate(); Yii::$app->response->format = Response::FORMAT_JSON; $result = []; if ($migrator->error) { $result['error'] = $migrator->error->getMessage(); } else { $result['success'] = Yii::t('b/radiata/common', 'Migrations were applied successfully'); } return $result; } }