fix: use proper migration sorting when checking if a migration needs to be executed

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2025-04-02 14:29:08 +02:00
parent f3761c5bd6
commit fc2cda12b5
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

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