Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nextras/migrations
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: eed98c29929341ca4abbc2827ab61c2219e21c02
Choose a base ref
..
head repository: nextras/migrations
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 93444e2f90fcdb2fb83e052dce684c0758ef0331
Choose a head ref
Showing with 16 additions and 14 deletions.
  1. +16 −14 src/Engine/OrderResolver.php
30 changes: 16 additions & 14 deletions src/Engine/OrderResolver.php
Original file line number Diff line number Diff line change
@@ -83,23 +83,25 @@ public function resolve(array $migrations, array $groups, array $files, string $
$files = $this->getFlatFiles($files);
$files = $this->sortFiles($files, $groups);

if ($group->checkDependMigration) {
foreach ($groups as $group) {
if (!isset($lastMigrations[$group->name])) {
foreach ($groups as $group) {
if (!isset($lastMigrations[$group->name])) {
continue;
}

if (!$group->checkDependMigration) {
continue;
}

foreach ($this->getFirstFiles($files) as $file) {
if (strcmp($file->name, $lastMigrations[$group->name]) >= 0) {
continue;
}

foreach ($this->getFirstFiles($files) as $file) {
if (strcmp($file->name, $lastMigrations[$group->name]) >= 0) {
continue;
}

if ($this->isGroupDependentOn($groups, $file->group, $group) || $this->isGroupDependentOn($groups, $group, $file->group)) {
throw new LogicException(sprintf(
'New migration "%s/%s" must follow after the latest executed migration "%s/%s".',
$file->group->name, $file->name, $group->name, $lastMigrations[$group->name]
));
}
if ($this->isGroupDependentOn($groups, $file->group, $group) || $this->isGroupDependentOn($groups, $group, $file->group)) {
throw new LogicException(sprintf(
'New migration "%s/%s" must follow after the latest executed migration "%s/%s".',
$file->group->name, $file->name, $group->name, $lastMigrations[$group->name]
));
}
}
}