Skip to content

Commit

Permalink
Make possible call NextrasMigrationsDriver ::continue or ::reset mult…
Browse files Browse the repository at this point in the history
…iple times
  • Loading branch information
trejjam committed Mar 17, 2018
1 parent 6750a03 commit 7aa3b59
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 7aa3b59

Please sign in to comment.