Skip to content

Commit

Permalink
Clearer Formatting for migrate:status command.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Jul 26, 2018
1 parent 31f15bb commit a77aab3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
24 changes: 15 additions & 9 deletions system/Commands/Database/MigrateStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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)
{
Expand All @@ -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)
Expand All @@ -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 : '---'));
}
}
}
Expand Down
1 change: 0 additions & 1 deletion system/Language/en/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: ',

Expand Down

0 comments on commit a77aab3

Please sign in to comment.