/** * Run the outstanding migrations for a given bundle. * * @param string $bundle * @param int $version * @return void */ public function migrate($bundle = null, $version = null) { $migrations = $this->resolver->outstanding($bundle); if (count($migrations) == 0) { echo "No outstanding migrations."; return; } // We need to grab the latest batch ID and increment it by one. // This allows us to group the migrations so we can easily // determine which migrations need to roll back. $batch = $this->database->batch() + 1; foreach ($migrations as $migration) { $migration['migration']->up(); echo 'Migrated: ' . $this->display($migration) . PHP_EOL; // After running a migration, we log its execution in the migration // table so that we can easily determine which migrations we'll // reverse in the event of a migration rollback. $this->database->log($migration['bundle'], $migration['name'], $batch); } }