/** * Migrate the database schema * * Adjusts the database structure by applying the pending * migrations provided by currently active packages. * * @param string $version The version to migrate to * @param string $output A file to write SQL to, instead of executing it * @param boolean $dryRun Whether to do a dry run or not * @param boolean $quiet If set, only the executed migration versions will be output, one per line * @return void * @see typo3.flow:doctrine:migrationstatus * @see typo3.flow:doctrine:migrationexecute * @see typo3.flow:doctrine:migrationgenerate * @see typo3.flow:doctrine:migrationversion */ public function migrateCommand($version = null, $output = null, $dryRun = false, $quiet = false) { // "driver" is used only for Doctrine, thus we (mis-)use it here // additionally, when no path is set, skip this step, assuming no DB is needed if ($this->settings['backendOptions']['driver'] !== null && $this->settings['backendOptions']['host'] !== null) { try { $result = $this->doctrineService->executeMigrations($version, $output, $dryRun, $quiet); if ($result == '') { if (!$quiet) { $this->outputLine('No migration was necessary.'); } } elseif ($output === null) { $this->outputLine($result); } else { if (!$quiet) { $this->outputLine('Wrote migration SQL to file "' . $output . '".'); } } $this->emitAfterDatabaseMigration(); } catch (\Exception $exception) { $this->handleException($exception); } } else { $this->outputLine('Doctrine migration not possible, the driver and host backend options are not set in /Configuration/Settings.yaml.'); $this->quit(1); } }
/** * Migrate the database schema * * Adjusts the database structure by applying the pending * migrations provided by currently active packages. * * @param string $version The version to migrate to * @param string $output A file to write SQL to, instead of executing it * @param boolean $dryRun Whether to do a dry run or not * @param boolean $quiet If set, only the executed migration versions will be output, one per line * @return void * @see typo3.flow:doctrine:migrationstatus * @see typo3.flow:doctrine:migrationexecute * @see typo3.flow:doctrine:migrationgenerate * @see typo3.flow:doctrine:migrationversion */ public function migrateCommand($version = null, $output = null, $dryRun = false, $quiet = false) { if (!$this->isDatabaseConfigured()) { $this->outputLine('Doctrine migration not possible, the driver and host backend options are not set in /Configuration/Settings.yaml.'); $this->quit(1); } try { $result = $this->doctrineService->executeMigrations($version, $output, $dryRun, $quiet); if ($result == '') { if (!$quiet) { $this->outputLine('No migration was necessary.'); } } elseif ($output === null) { $this->outputLine($result); } else { if (!$quiet) { $this->outputLine('Wrote migration SQL to file "' . $output . '".'); } } $this->emitAfterDatabaseMigration(); } catch (\Exception $exception) { $this->handleException($exception); } }