/** * Displays a list of all migrations and whether they've been run or not. */ public function status() { $migrations = $this->runner->findMigrations(); $history = $this->runner->getHistory(); if (empty($migrations)) { return CLI::error('No migrations were found.'); } $max = 0; foreach ($migrations as $version => $file) { $file = substr($file, strpos($file, $version . '_')); $migrations[$version] = $file; $max = max($max, strlen($file)); } CLI::write(str_pad('Filename', $max + 4) . 'Migrated On', 'yellow'); foreach ($migrations as $version => $file) { $date = ''; foreach ($history as $row) { if ($row['version'] != $version) { continue; } $date = $row['time']; } CLI::write(str_pad($file, $max + 4) . ($date ? $date : '---')); } }