From 84794f93d9ab6a64915293e36a6c74876b800f37 Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 16 Jul 2019 02:34:22 +0300 Subject: [PATCH] Made console commands lazy --- lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php | 4 +++- .../Migrations/Tools/Console/Command/DumpSchemaCommand.php | 4 +++- .../Migrations/Tools/Console/Command/ExecuteCommand.php | 4 +++- .../Migrations/Tools/Console/Command/GenerateCommand.php | 4 +++- .../Migrations/Tools/Console/Command/LatestCommand.php | 4 +++- .../Migrations/Tools/Console/Command/MigrateCommand.php | 4 +++- .../Migrations/Tools/Console/Command/RollupCommand.php | 4 +++- .../Migrations/Tools/Console/Command/StatusCommand.php | 4 +++- .../Migrations/Tools/Console/Command/UpToDateCommand.php | 4 +++- .../Migrations/Tools/Console/Command/VersionCommand.php | 4 +++- 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php index 98c1dfa5bc..10e3974a5e 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php @@ -22,6 +22,9 @@ */ class DiffCommand extends AbstractCommand { + /** @var string */ + protected static $defaultName = 'migrations:diff'; + /** @var SchemaProviderInterface|null */ protected $schemaProvider; @@ -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(<<setName('migrations:dump-schema') ->setAliases(['dump-schema']) ->setDescription('Dump the schema for your database to a migration.') ->setHelp(<<setName('migrations:execute') ->setAliases(['execute']) ->setDescription( 'Execute a single migration version up or down manually.' diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/GenerateCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/GenerateCommand.php index e3921172cc..18a696c4f6 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/GenerateCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/GenerateCommand.php @@ -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( diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/LatestCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/LatestCommand.php index e469d0f415..592239a878 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/LatestCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/LatestCommand.php @@ -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'); diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php index 8e7e9051dc..e6a7cc6190 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php @@ -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.' diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php index 621e7e4caf..7f20cdc90e 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/RollupCommand.php @@ -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(<<setName('migrations:status') ->setAliases(['status']) ->setDescription('View the status of a set of migrations.') ->addOption( diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/UpToDateCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/UpToDateCommand.php index 8e9d402e20..68344fbfd6 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/UpToDateCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/UpToDateCommand.php @@ -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') diff --git a/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php b/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php index 3a363fcb3a..2244da39df 100644 --- a/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php +++ b/lib/Doctrine/Migrations/Tools/Console/Command/VersionCommand.php @@ -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(