This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
319 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class CurrentCommand extends AbstractCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'doctrine:migrations:current'; | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setAliases(['current']) | ||
->setDescription('Outputs the current version') | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\CurrentCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class LatestCommand extends AbstractCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'doctrine:migrations:latest'; | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setAliases(['latest']) | ||
->setDescription('Outputs the latest version') | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\LatestCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class ListCommand extends AbstractCommand | ||
{ | ||
protected static $defaultName = 'doctrine:migrations:list'; | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setAliases(['list-migrations']) | ||
->setDescription('Display a list of all available migrations and their status.') | ||
->setHelp(<<<EOT | ||
The <info>%command.name%</info> command outputs a list of all available migrations and their status: | ||
<info>%command.full_name%</info> | ||
EOT | ||
) | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\CurrentCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class StatusCommand extends AbstractCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'doctrine:migrations:status'; | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setAliases(['status']) | ||
->setDescription('View the status of a set of migrations.') | ||
->setHelp(<<<EOT | ||
The <info>%command.name%</info> command outputs the status of a set of migrations: | ||
<info>%command.full_name%</info> | ||
EOT | ||
) | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\StatusCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class SyncMetadataCommand extends AbstractCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'doctrine:migrations:sync-metadata-storage'; | ||
|
||
protected function configure() : void | ||
{ | ||
parent::configure(); | ||
|
||
$this | ||
->setAliases(['sync-metadata-storage']) | ||
->setDescription('Ensures that the metadata storage is at the latest version.') | ||
->setHelp(<<<EOT | ||
The <info>%command.name%</info> command updates metadata storage the latest version. | ||
<info>%command.full_name%</info> | ||
EOT | ||
) | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\SyncMetadataCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace AvaiBookSports\Bundle\MigrationsMutlipleDatabase\Command\Doctrine; | ||
|
||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class UpToDateCommand extends AbstractCommand | ||
{ | ||
/** @var string */ | ||
protected static $defaultName = 'doctrine:migrations:up-to-date'; | ||
|
||
protected function configure() : void | ||
{ | ||
$this | ||
->setAliases(['up-to-date']) | ||
->setDescription('Tells you if your schema is up-to-date.') | ||
->addOption('fail-on-unregistered', 'u', InputOption::VALUE_NONE, 'Whether to fail when there are unregistered extra migrations found') | ||
->addOption('list-migrations', 'l', InputOption::VALUE_NONE, 'Show a list of missing or not migrated versions.') | ||
->setHelp(<<<EOT | ||
The <info>%command.name%</info> command tells you if your schema is up-to-date: | ||
<info>%command.full_name%</info> | ||
EOT | ||
) | ||
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the Entity Manager to handle.') | ||
; | ||
|
||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$newInput = new ArrayInput([ | ||
'--fail-on-unregistered' => $input->getOption('fail-on-unregistered'), | ||
'--list-migrations' => $input->getOption('list-migrations'), | ||
]); | ||
|
||
$newInput->setInteractive($input->isInteractive()); | ||
|
||
foreach ($this->getDependencyFactories(strval($input->getOption('em'))) as $dependencyFactory) { | ||
$otherCommand = new \Doctrine\Migrations\Tools\Console\Command\UpToDateCommand($dependencyFactory); | ||
$otherCommand->run($newInput, $output); | ||
} | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters