Esempio n. 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var DialogHelper $dialog */
     $this->dialog = $this->getHelper('dialog');
     $this->setInteraction($input, $output);
     $dbService = $this->getDbService($input, $output);
     if (!$dbService) {
         return;
     }
     $compareService = new CompareService($dbService);
     $loadTables = $this->dialog->askConfirmation($output, '<question>Do you wish to load table dependencies while loading the schemas? (Recommended)</question>', true);
     $dbs = $compareService->getDatabases($loadTables);
     $done = [];
     do {
         $tasks = $this->getTasks($output, $done);
         foreach ($tasks as $task) {
             $done[$task] = $this->processTask($task, $compareService, $output, $dbs, $loadTables);
         }
         $quit = $this->dialog->askConfirmation($output, '<question>Do you want to quit?</question>', true);
     } while ($quit === false);
     $this->outputQueries($output, $done);
 }
Esempio n. 2
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param DbService $dbService
  */
 private function ensureCleanExit(InputInterface $input, OutputInterface $output, DbService $dbService)
 {
     //begin comparing
     $compareService = new CompareService($dbService);
     //see if we only need to compare specific tables
     $tables = $input->getArgument('tables');
     if (!$tables) {
         $output->writeln('<info>Comparing all tables</info>');
         $tables = null;
         //ensure whitelist is null, not an empty array
     } else {
         $output->writeln(sprintf('<info>Attempt to compare tables: %s</info>', implode(', ', $tables)));
     }
     //default is to link tables...
     if ($this->interactive >= self::INTERACTION_HIGH) {
         $loadTables = $this->dialog->askConfirmation($output, '<question>Do you wish to load table dependencies while loading the schemas? (Recommended)</question>', true);
     } else {
         $loadTables = true;
     }
     $dbs = $compareService->getDatabases($tables, $loadTables);
     $done = [];
     do {
         $tasks = $this->getTasks($output, $done);
         foreach ($tasks as $task) {
             $done[$task] = $this->processTask($task, $compareService, $output, $dbs, $loadTables);
         }
         $quit = $this->dialog->askConfirmation($output, '<question>Do you want to quit?</question>', true);
     } while ($quit === false);
     $this->outputQueries($output, $done);
 }