From 494bd7549b8ed6ac902269424ada5f736a6e0346 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 2 Apr 2025 14:29:08 +0200 Subject: [PATCH] fix: use proper migration sorting when checking if a migration needs to be executed Signed-off-by: Robin Appelman --- lib/private/DB/MigrationService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index daa2d9940c713..398b92987a854 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -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)); } /** @@ -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)) {