private function migrateDatabase() { $this->IOHelper->writeln("Apply database migrations..."); if (!is_dir(UPDATE_ASSET_PATH . '/migrations/')) { $this->IOHelper->writeln("skipped..."); return 1; } /** @var MigrationManager $manager */ $manager = $this->container->get('migration.manager'); $currentVersion = $manager->getCurrentVersion(); $versions = $manager->getMigrationsForVersion($currentVersion); $progress = $this->IOHelper->createProgressBar(count($versions)); $progress->start(); $step = new MigrationStep($manager); $offset = 0; do { $progress->setCurrent($offset); $result = $step->run($offset); if ($result instanceof ErrorResult) { throw new \Exception($result->getMessage(), 0, $result->getException()); } $offset = $result->getOffset(); $progress->setCurrent($offset); } while ($result instanceof ValidResult); $progress->finish(); $this->IOHelper->writeln(""); }
public function applyMigrations() { /** @var Manager $migrationManger */ $migrationManger = $this->container->get('migration.manager'); $migrationStep = new MigrationStep($migrationManger); $offset = $this->request->get('offset'); $total = $this->request->get('total'); $result = $migrationStep->run($offset, $total); $this->toJson(200, $this->resultMapper->toExtJs($result)); }