Пример #1
0
 /**
  * Create migrations from scripts & rollback files
  *
  * @return void
  *
  * @throws \RuntimeException
  * @throws \LogicException
  */
 private function createMigrations()
 {
     $scripts = $this->locator->findScripts();
     $rollbacks = $this->locator->findRollbackScripts();
     $this->releaseChecker->checkScripts($scripts, $rollbacks);
     foreach ($scripts as $k => $script) {
         $this->createMigration($script, $rollbacks[$k]);
     }
 }
Пример #2
0
 /**
  * Execute command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \RuntimeException
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->configureOptions($input);
     $rows = $failed = array();
     foreach ($this->finder->findAll() as $release) {
         $this->locator->setParams(array('release' => $release));
         $scripts = $rollbacks = array();
         $status = '<fg=green>OK</fg=green>';
         try {
             $scripts = $this->locator->findScripts();
             $rollbacks = $this->locator->findRollbackScripts();
             $this->checker->check($scripts, $rollbacks);
         } catch (\Exception $e) {
             $status = sprintf('<fg=red>%s</fg=red>', $e->getMessage());
             $failed[] = $release;
         }
         $rows[] = array($release, count($scripts), count($rollbacks), $status);
     }
     $this->display($output, $rows, $failed);
 }