]> git.andy128k.dev Git - migrations.git/commitdiff
fix migrations order master
authorAndrey Kutejko <andy128k@gmail.com>
Mon, 30 Mar 2015 17:22:28 +0000 (20:22 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Mon, 30 Mar 2015 17:22:28 +0000 (20:22 +0300)
src/migrations.php

index 94baff68eb60bb9de8bfab24abae3bdab265ad01..f7e494aaaa9de7502cfb5dd57273d83d747587f7 100644 (file)
@@ -12,7 +12,11 @@ class Migrations
         foreach ($paths as $path)
             $files = array_merge($files, glob($path.'/*.php'));
 
         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);
 
         foreach ($files as $file) {
             $ts = substr(basename($file), 0, 14);