0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-02 04:50:37 +00:00

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

fix: use proper migration sorting when checking if a migration needs to be executed
This commit is contained in:
Robin Appelman 2025-04-02 14:52:18 +02:00 committed by GitHub
commit f7d5edfb5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)) {