From a77aab36fbf295593ae654b7cf2ef3e8e7014985 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Thu, 26 Jul 2018 12:48:30 -0500 Subject: [PATCH] Clearer Formatting for migrate:status command. --- system/Commands/Database/MigrateStatus.php | 24 ++++++++++++++-------- system/Language/en/Migrations.php | 1 - 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/system/Commands/Database/MigrateStatus.php b/system/Commands/Database/MigrateStatus.php index 364dc422c90e..b51dfb7a3a80 100644 --- a/system/Commands/Database/MigrateStatus.php +++ b/system/Commands/Database/MigrateStatus.php @@ -93,6 +93,12 @@ class MigrateStatus extends BaseCommand '-g' => 'Set database group', ]; + protected $ignoredNamespaces = [ + 'CodeIgniter', + 'Config', + 'Tests\Support' + ]; + /** * Displays a list of all migrations and whether they've been run or not. * @@ -114,25 +120,25 @@ public function run(array $params = []) // Loop for all $namespaces foreach ($namespaces as $namespace => $path) { + if (in_array($namespace, $this->ignoredNamespaces)) + { + continue; + } $runner->setNamespace($namespace); $migrations = $runner->findMigrations(); $history = $runner->getHistory(); + CLI::write($namespace); + if (empty($migrations)) { - CLI::error("$namespace: " . lang('Migrations.noneFound')); + CLI::error(lang('Migrations.noneFound')); continue; } ksort($migrations); - CLI::newLine(1); - - CLI::write(lang('Migrations.historyFor') . "$namespace: ", 'green'); - - CLI::newLine(1); - $max = 0; foreach ($migrations as $version => $migration) { @@ -142,7 +148,7 @@ public function run(array $params = []) $max = max($max, strlen($file)); } - CLI::write(str_pad(lang('Migrations.filename'), $max + 6) . lang('Migrations.on'), 'yellow'); + CLI::write(' '. str_pad(lang('Migrations.filename'), $max + 4) . lang('Migrations.on'), 'yellow'); foreach ($migrations as $version => $migration) @@ -157,7 +163,7 @@ public function run(array $params = []) $date = date("Y-m-d H:i:s", $row['time']); } - CLI::write(str_pad($migration->name, $max + 6) . ($date ? $date : '---')); + CLI::write(str_pad(' '.$migration->name, $max + 6) . ($date ? $date : '---')); } } } diff --git a/system/Language/en/Migrations.php b/system/Language/en/Migrations.php index 98e52cb39e78..2f498d5f2a9a 100644 --- a/system/Language/en/Migrations.php +++ b/system/Language/en/Migrations.php @@ -45,7 +45,6 @@ 'on' => 'Migrated On: ', 'migSeeder' => 'Seeder name', 'migMissingSeeder' => 'You must provide a seeder name.', - 'historyFor' => 'Migration history For ', 'removed' => 'Rolling back: ', 'added' => 'Running: ',