From: Andrey Kutejko Date: Mon, 30 Mar 2015 17:22:28 +0000 (+0300) Subject: fix migrations order X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;ds=inline;p=migrations.git fix migrations order --- diff --git a/src/migrations.php b/src/migrations.php index 94baff6..f7e494a 100644 --- a/src/migrations.php +++ b/src/migrations.php @@ -12,7 +12,11 @@ class Migrations foreach ($paths as $path) $files = array_merge($files, glob($path.'/*.php')); - sort($files); + usort($files, function($a, $b) { + return strcmp( + substr(basename($a), 0, 14), + substr(basename($b), 0, 14)); + }); foreach ($files as $file) { $ts = substr(basename($file), 0, 14);