public function runDowngrade(Connection $conn, BaseDriver $driver, array $scripts = null, $steps = 1)
{
if (!$scripts) {
$scripts = $this->getDowngradeScripts($conn, $driver);
}
$this->logger->info('Found ' . count($scripts) . ' migration scripts to run downgrade!');
while ($steps--) {
// downgrade a migration one at one time.
if ($script = array_pop($scripts)) {
$this->logger->info("Running {$script}::downgrade");
$migration = new $script($conn, $driver, $this->logger);
$migration->downgrade();
if ($nextScript = end($scripts)) {
$id = $nextScript::getId();
$this->updateLastMigrationId($conn, $driver, $id);
$this->logger->info("Updated migration timestamp to {$id}.");
}
}
}
}