Skip to content

Commit

Permalink
Merge pull request #839 from vudaltsov/lazy-console-commands
Browse files Browse the repository at this point in the history
Lazy console commands
  • Loading branch information
alcaeus authored Jul 30, 2019
2 parents 0069f40 + 84794f9 commit 85e30d8
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
class DiffCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:diff';

/** @var SchemaProviderInterface|null */
protected $schemaProvider;

Expand All @@ -37,7 +40,6 @@ protected function configure() : void
parent::configure();

$this
->setName('migrations:diff')
->setAliases(['diff'])
->setDescription('Generate a migration by comparing your current database to your mapping information.')
->setHelp(<<<EOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
*/
class DumpSchemaCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:dump-schema';

protected function configure() : void
{
parent::configure();

$this
->setName('migrations:dump-schema')
->setAliases(['dump-schema'])
->setDescription('Dump the schema for your database to a migration.')
->setHelp(<<<EOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
*/
class ExecuteCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:execute';

protected function configure() : void
{
$this
->setName('migrations:execute')
->setAliases(['execute'])
->setDescription(
'Execute a single migration version up or down manually.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
*/
class GenerateCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:generate';

protected function configure() : void
{
$this
->setName('migrations:generate')
->setAliases(['generate'])
->setDescription('Generate a blank migration class.')
->addOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
*/
class LatestCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:latest';

protected function configure() : void
{
$this
->setName('migrations:latest')
->setAliases(['latest'])
->setDescription('Outputs the latest version number');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
*/
class MigrateCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:migrate';

protected function configure() : void
{
$this
->setName('migrations:migrate')
->setAliases(['migrate'])
->setDescription(
'Execute a migration to a specified version or the latest available version.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
*/
class RollupCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:rollup';

protected function configure() : void
{
parent::configure();

$this
->setName('migrations:rollup')
->setAliases(['rollup'])
->setDescription('Rollup migrations by deleting all tracked versions and insert the one version that exists.')
->setHelp(<<<EOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
*/
class StatusCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:status';

protected function configure() : void
{
$this
->setName('migrations:status')
->setAliases(['status'])
->setDescription('View the status of a set of migrations.')
->addOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
*/
class UpToDateCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:up-to-date';

protected function configure() : void
{
$this
->setName('migrations:up-to-date')
->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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
*/
class VersionCommand extends AbstractCommand
{
/** @var string */
protected static $defaultName = 'migrations:version';

/** @var bool */
private $markMigrated;

protected function configure() : void
{
$this
->setName('migrations:version')
->setAliases(['version'])
->setDescription('Manually add and delete migration versions from the version table.')
->addArgument(
Expand Down

0 comments on commit 85e30d8

Please sign in to comment.