Skip to content

Commit

Permalink
Merge pull request #2 from Scalesoft/feature/improve-migration-driver
Browse files Browse the repository at this point in the history
Make possible call NextrasMigrationsDriver ::continue multiple times
  • Loading branch information
matej21 authored Mar 18, 2018
2 parents 6750a03 + 7aa3b59 commit f20c8ad
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Bridges/NextrasMigrations/NextrasMigrationsDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,30 @@ public function printError(Exception $e)
throw $e;
}
});

foreach ($configuration->getGroups() as $group) {
$runner->addGroup($group);
}

foreach ($configuration->getExtensionHandlers() as $ext => $handler) {
$runner->addExtensionHandler($ext, $handler);
}

$this->migrationsRunner = $runner;
$this->configuration = $configuration;
}


public function reset(): void
{
$this->migrationsRunner->run(Runner::MODE_RESET, $this->configuration);
$this->migrationsRunner->run(Runner::MODE_RESET);
}


public function continue(): void
{
try {
$this->migrationsRunner->run(Runner::MODE_CONTINUE, $this->configuration);
$this->migrationsRunner->run(Runner::MODE_CONTINUE);
} catch (LogicException $e) {
throw new CannotContinueMigrationException($e->getMessage(), 0, $e);
}
Expand Down

0 comments on commit f20c8ad

Please sign in to comment.