Merge pull request #51866 from nextcloud/migrations-to-execute-filter-sort

fix: use proper migration sorting when checking if a migration needs to be executed
pull/51848/head
Robin Appelman 2025-04-02 14:52:18 +07:00 committed by GitHub
commit f7d5edfb5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

@ -199,9 +199,9 @@ class MigrationService {
if ($versionA !== $versionB) { if ($versionA !== $versionB) {
return ($versionA < $versionB) ? -1 : 1; 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));
} }
/** /**
@ -250,7 +250,7 @@ class MigrationService {
$toBeExecuted = []; $toBeExecuted = [];
foreach ($availableMigrations as $v) { foreach ($availableMigrations as $v) {
if ($to !== 'latest' && $v > $to) { if ($to !== 'latest' && ($this->sortMigrations($v, $to) > 0)) {
continue; continue;
} }
if ($this->shallBeExecuted($v, $knownMigrations)) { if ($this->shallBeExecuted($v, $knownMigrations)) {