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 authored and backportbot[bot] committed Apr 2, 2025
commit 494bd7549b8ed6ac902269424ada5f736a6e0346
6 changes: 3 additions & 3 deletions lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,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 @@ -272,7 +272,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