Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: use proper migration sorting when checking if a migration needs …
…to be executed

Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Apr 2, 2025
commit fc2cda12b5af11037dcb5b54df14336d796c385b
6 changes: 3 additions & 3 deletions lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ protected function sortMigrations(string $a, string $b): int {
if ($versionA !== $versionB) {
return ($versionA < $versionB) ? -1 : 1;
}
return ($matchA[2] < $matchB[2]) ? -1 : 1;
return strnatcmp($matchA[2], $matchB[2]);
}
return (basename($a) < basename($b)) ? -1 : 1;
return strnatcmp(basename($a), basename($b));
}

/**
Expand Down Expand Up @@ -250,7 +250,7 @@ private function getMigrationsToExecute($to) {

$toBeExecuted = [];
foreach ($availableMigrations as $v) {
if ($to !== 'latest' && $v > $to) {
if ($to !== 'latest' && ($this->sortMigrations($v, $to) > 0)) {
continue;
}
if ($this->shallBeExecuted($v, $knownMigrations)) {
Expand Down
Loading