/var/www/vhosts/ihelp.ro/httpdocs/vendor/robmorgan/phinx/src/Phinx/Console/Command
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/robmorgan/phinx/src/Phinx/Console/Command/Status.php (3142B)
addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment.');
$this->setDescription('Show migration status')
->addOption('--format', '-f', InputOption::VALUE_REQUIRED, 'The output format: text or json. Defaults to text.')
->setHelp(
<<
status command prints a list of all migrations, along with their current status
phinx status -e development
phinx status -e development -f json
The version_order configuration option is used to determine the order of the status migrations.
EOT
);
}
/**
* Show the migration status.
*
* @param \Symfony\Component\Console\Input\InputInterface $input Input
* @param \Symfony\Component\Console\Output\OutputInterface $output Output
* @return int 0 if all migrations are up, or an error code
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->bootstrap($input, $output);
/** @var string|null $environment */
$environment = $input->getOption('environment');
/** @var string|null $environment */
$format = $input->getOption('format');
if ($environment === null) {
$environment = $this->getConfig()->getDefaultEnvironment();
$output->writeln('warning no environment specified, defaulting to: ' . $environment, $this->verbosityLevel);
} else {
$output->writeln('using environment ' . $environment, $this->verbosityLevel);
}
if (!$this->getConfig()->hasEnvironment($environment)) {
$output->writeln(sprintf('The environment "%s" does not exist', $environment));
return self::CODE_ERROR;
}
if ($format !== null) {
$output->writeln('using format ' . $format, $this->verbosityLevel);
}
$output->writeln('ordering by ' . $this->getConfig()->getVersionOrder() . ' time', $this->verbosityLevel);
// print the status
$result = $this->getManager()->printStatus($environment, $format);
if ($result['hasMissingMigration']) {
return self::CODE_STATUS_MISSING;
} elseif ($result['hasDownMigration']) {
return self::CODE_STATUS_DOWN;
}
return self::CODE_SUCCESS;
}
}