Skip to content

Commit e1d98a1

Browse files
Merge pull request #51867 from nextcloud/backport/51866/stable29
[stable29] fix: use proper migration sorting when checking if a migration needs to be executed
2 parents efc307f + 494bd75 commit e1d98a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/private/DB/MigrationService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ protected function sortMigrations(string $a, string $b): int {
221221
if ($versionA !== $versionB) {
222222
return ($versionA < $versionB) ? -1 : 1;
223223
}
224-
return ($matchA[2] < $matchB[2]) ? -1 : 1;
224+
return strnatcmp($matchA[2], $matchB[2]);
225225
}
226-
return (basename($a) < basename($b)) ? -1 : 1;
226+
return strnatcmp(basename($a), basename($b));
227227
}
228228

229229
/**
@@ -272,7 +272,7 @@ private function getMigrationsToExecute($to) {
272272

273273
$toBeExecuted = [];
274274
foreach ($availableMigrations as $v) {
275-
if ($to !== 'latest' && $v > $to) {
275+
if ($to !== 'latest' && ($this->sortMigrations($v, $to) > 0)) {
276276
continue;
277277
}
278278
if ($this->shallBeExecuted($v, $knownMigrations)) {

0 commit comments

Comments
 (0)