/** * 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 : '---')); } }
/** * Ensures that the database is cleaned up to a known state * before each test runs. * * @throws ConfigException */ public function setUp() { $this->loadDependencies(); if ($this->refresh === true) { if (!empty($this->basePath)) { $this->migrations->setPath(rtrim($this->basePath, '/') . '/migrations'); } $this->db->table('migrations')->truncate(); $this->migrations->version(0, 'tests'); $this->migrations->latest('tests'); } if (!empty($this->seed)) { if (!empty($this->basePath)) { $this->seeder->setPath(rtrim($this->basePath, '/') . '/seeds'); } $this->seed($this->seed); } }