Check the database schema exists is consistent with the configuration.

@param InputInterface  $input
@param OutputInterface $output

@return bool
322266
protected function reconcileDatabaseSchema(InputInterface $input, OutputInterface $output)
    {
        if ($this->isDbSetup === false) {
            return true;
        }
        $this->step(++$this->step, 'Checking Database Schema');
        $command = $this->getApplication()->find('database:check');
        $buffer = $this->getBufferedOutput($output, OutputInterface::VERBOSITY_QUIET);
        $subInput = new ArrayInput([
            '--no-interaction' => true,
        ]);

        $result = $command->run($subInput, $buffer);
        $this->writeBufferedOutput($buffer, $result);
        if ($result === 0) {
            return true;
        }

        $this->step(++$this->step, 'Updating Database Schema');
        $command = $this->getApplication()->find('database:update');
        $subInput = new ArrayInput([]);
        $subInput->setInteractive(!$input->isInteractive());

        $result = $command->run($subInput, $output);

        return $result === 0;
    }
196980
protected function execute(InputInterface $input, OutputInterface $output) {
		if (!file_exists(\Skeleton\Database\Migration\Config::$migration_directory)) {
			$output->writeln('<error>Config::$migration_directory is not set to a valid directory</error>');
			return 1;
		}

		$migrations = \Skeleton\Database\Migration\Runner::get_runnable();

		if (count($migrations) > 0) {
			$output->writeln('There are ' . count($migrations) . ' outstanding migrations:');
		} else {
			$output->writeln('Database is up-to-date');
		}


		$migration_count = 0;
		foreach ($migrations as $migration) {
			try {
				$package = $migration->get_skeleton();
				$package = $package->name;
			} catch (\Exception $e) {
				$package = 'project';
			}


			if (preg_match('@\\\\([\w]+)$@', get_class($migration), $matches)) {
				$classname = $matches[1];
			} else {
				$classname = get_class($migration);
			}
			$output->writeln("\t" . $package . ' / ' . $classname);
		}

		return 0;
	}
227753
protected function checkSchemaUpdate(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
    {
        $question = new Question('<info>Update database schema</info> [<comment>yes</comment>]: ', 'yes');
        $question->setAutocompleterValues(['yes', 'no']);
        $wantDump = $questionHelper->ask($input, $output, $question);
        $deployData['schemadb'] = $wantDump == 'yes' ? true : false;

        return $deployData['schemadb'];
    }
670106
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->clear($this->_config->get('cache'), $output);
        $this->clear($this->_config->get('session_location'), $output);
    }
1090741
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);
        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemas()
            ;
        $this->formatOutput($output, $info);
    }
807865
protected function execute(InputInterface $input, OutputInterface $output): bool
    {
        $name = $input->getArgument('name');
        $aggregated = $this->outputsAggregator->getAggregated($name);
        if ($aggregated instanceof AbstractOutput) {
            try {
                return $aggregated->apply();
            } catch (\Exception $e) {
                $output->writeln($e->getMessage());
                return false;
            }
        } else {
            $output->writeln('This output does not exists');
        }

        return true;
    }
310074
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $adapter = $this->databaseImportExportAdapterManager->getAdapter($input->getOption('adapter'));
        $adapter->setLogger($this->logger);

        $database = $input->getArgument('database');
        $filename = $input->getArgument('filename');

        $this->logger->info("Importing \"$filename\" into database \"$database\".");
        $adapter->importFromFile(
            $filename,
            $database,
            [] // This command does not yet support any options
        );
        $this->logger->info("\"$filename\" imported into database \"$database\".");
        return 0;
    }
823967
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $migrationsTemplate = base_path().'/storage/migrations';
        $migration = $input->getArgument('migration');

        $file = file($migrationsTemplate);
        foreach ($file as $item) {
            $itemexp = explode('_', str_replace('.php', '', $item));

            for ($i = 0; $i < 4; $i++) {
                array_shift($itemexp);
            }

            $name = trim(implode('_', $itemexp));

            if ($migration == $name) {
                $path = trim(base_path().'/database/'.$item);
                if (file_exists($path)) {
                    $output->writeln('<info>Rolling back migration</info>');
                    foreach ($itemexp as $key => $ie) {
                        $itemexp[$key] = ucwords($ie);
                    }
                    $mn = str_replace('_', '', implode('_', $itemexp));
                    shell_exec('php cli db:rollback '.$mn);
                    $output->writeln('<info>Removing migration from file system</info>');
                    unlink($path);
                    $output->writeln('<info>Removing from migrations cache</info>');

                    $key = array_keys($file, $item);
                    array_splice($file, $key[0]);

                    $handle = fopen($migrationsTemplate, 'w');
                    foreach ($file as $f) {
                        fwrite($handle, $f);
                    }
                    fclose($handle);
                } else {
                    $output->writeln("<error>$migration does not exist!</error>");
                }
            }
        }
    }
21631
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setup->getLocator()->setParams(
            array(
                'release' => $input->getArgument('release'),
                'path' => $input->getOption('path'),
                'scriptName' => $input->getOption('script')
            )
        );

        $queries = $this->setup($input);

        $this->display($input, $output, $queries);
    }
1095963
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);
        $output->writeln('Starting data import');

        $this->migrateData->setOutputInterface($output)->run();

        $output->writeln(sprintf('Import complete in %s', round(microtime(true) - $start, 2)));
    }
285874
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $session = $this->mustBeModelManagerSession($this->getSession());

        $relations = $session->getInspector()
            ->getSchemaRelations($this->fetchSchemaOid()
        );

        $output->writeln(
            sprintf(
                "Scanning schema '<fg=green>%s</fg=green>'.",
                $this->schema
            )
        );

        if ($relations->isEmpty()) {
            $output->writeln("<bg=yellow>No relations found.</bg=yellow>");
        } else {
            foreach ($relations as $relation_info) {
                $command = $this->getApplication()->find('pomm:generate:relation-all');
                $arguments = [
                    'command'          => 'pomm:generate:relation-all',
                    'config-name'      => $this->config_name,
                    'relation'         => $relation_info['name'],
                    'schema'           => $this->schema,
                    '--force'          => $input->getOption('force'),
                    '--bootstrap-file' => $input->getOption('bootstrap-file'),
                    '--prefix-dir'     => $input->getOption('prefix-dir'),
                    '--prefix-ns'      => $input->getOption('prefix-ns'),
                    '--flexible-container' => $input->getOption('flexible-container'),
                    '--psr4'           => $input->getOption('psr4')
                ];
                $command->run(new ArrayInput($arguments), $output);
            }
        }
    }
1111320
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $table = $input->getArgument('table');

        $timestamp = date('Y_m_d_his').'_';

        $fileName = 'migrations/'.$timestamp.$table.'.php';

        $exp = explode('_', $table);
        $action = $exp[0];
        $tableName = $exp[1];
        for ($i = 0; $i < count($exp); $i++) {
            $exp[$i] = ucwords($exp[$i]);
        }
        $table = implode('', $exp);

        $content = <<<EOF
<?php

use Scara\Database\Blueprint;
use Scara\Database\Migration;

class $table extends Migration
{
    /**
     * For pushing migrations up
     *
     * @return void
     */
    public function up()
    {
        \$this->$action('$tableName', function(\$table)
        {
            // Place table rows here
        });
    }

    /**
     * For reversing migrations
     *
     * @return void
     */
    public function down()
    {
        // This is for removing the table
    }
}

EOF;

        $file = fopen(base_path().'/database/'.$fileName, 'w');
        fwrite($file, $content);
        fclose($file);

        $this->writeToMigrationsFile($fileName);

        $output->writeln('Created migration: '.$fileName.' successfully.');
    }
647715
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $name = $input->getArgument('name');
    $class = implode('', array_map('ucfirst', explode('_', str_replace(':', '_', $name))));

    if ($this->add($name, $class)) {
      return $output->writeln('<info>Command "' . $class . '" has been successfully created.</info>');
    }

    return $output->writeln('Command "' . $class . '" already exists.');
  }
1113451
public function isActivatedBy(InputInterface $input, OutputInterface $output): bool
    {
        foreach ($this->constraints as $constraint) {
            if (!$constraint->accepts($input, $output)) {
                return false;
            }
        }
        return true;
    }
741689
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->bootstrap($input, $output);

        $environment = $input->getOption('environment');
        $version = $input->getOption('target');
        $date = $input->getOption('date');
        $force = (bool)$input->getOption('force');
        $fake = (bool)$input->getOption('fake');

        $config = $this->getConfig();

        if ($environment === null) {
            $environment = $config->getDefaultEnvironment();
            $output->writeln('<comment>warning</comment> no environment specified, defaulting to: ' . $environment);
        } else {
            $output->writeln('<info>using environment</info> ' . $environment);
        }

        $envOptions = $config->getEnvironment($environment);
        if (isset($envOptions['adapter'])) {
            $output->writeln('<info>using adapter</info> ' . $envOptions['adapter']);
        }

        if (isset($envOptions['wrapper'])) {
            $output->writeln('<info>using wrapper</info> ' . $envOptions['wrapper']);
        }

        if (isset($envOptions['name'])) {
            $output->writeln('<info>using database</info> ' . $envOptions['name']);
        }

        $versionOrder = $this->getConfig()->getVersionOrder();
        $output->writeln('<info>ordering by </info>' . $versionOrder . " time");

        if ($fake) {
            $output->writeln('<comment>warning</comment> performing fake rollbacks');
        }

        // rollback the specified environment
        if ($date === null) {
            $targetMustMatchVersion = true;
            $target = $version;
        } else {
            $targetMustMatchVersion = false;
            $target = $this->getTargetFromDate($date);
        }

        $start = microtime(true);
        $this->getManager()->rollback($environment, $target, $force, $targetMustMatchVersion, $fake);
        $end = microtime(true);

        $output->writeln('');
        $output->writeln('<comment>All Done. Took ' . sprintf('%.4fs', $end - $start) . '</comment>');
    }
391571
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemaRelations($this->fetchSchemaOid()
        );
        $this->formatOutput($output, $info);
    }
739175
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateCommand($input);

        $output->writeln('> Loading configuration file');
        $config = $input->getOption('config');
        $files = (new ConfigResolver())->getFileList($config);
        $output->writeLn('- Found '.count($files).' files');

        $preloader = (new Factory())->create($this->getOptions($input));

        $outputFile = $input->getOption('output');
        $handle = $preloader->prepareOutput($outputFile, $input->getOption('strict_types'));

        $output->writeln('> Compiling classes');

        $count = 0;
        $countSkipped = 0;
        $comments = !$input->getOption('strip_comments');

        foreach ($files as $file) {
            $count++;

            try {
                $code = $preloader->getCode($file, $comments);
                $output->writeln('- Writing '.$file);
                fwrite($handle, $code."\n");
            } catch (VisitorExceptionInterface $e) {
                $countSkipped++;
                $output->writeln('- Skipping '.$file);
            }
        }

        fclose($handle);

        $output->writeln("> Compiled loader written to $outputFile");
        $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')');
        $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb');
    }