framework
framework copied to clipboard
[9.x] Fixes order of migrations in StatusCommand
The migrate:status command doesn't sort the migrations by batch when outputting to console.
I've noticed this issue by running an old migration I forgot to migrate after having ran other migrations.
This can be easily reproduced running the following commands on a fresh Laravel installation.
// Commands
php artisan migrate --path=/database/migrations/2014_10_12_100000_create_password_resets_table.php
php artisan migrate --path=/database/migrations/2014_10_12_000000_create_users_table.php
php artisan migrate --path=/database/migrations/2019_08_19_000000_create_failed_jobs_table.php
php artisan migrate:status
// Expected
2014_10_12_100000_create_password_resets_table ... [1] Ran
2014_10_12_000000_create_users_table ............. [2] Ran
2019_08_19_000000_create_failed_jobs_table ....... [3] Ran
// Actual
2014_10_12_000000_create_users_table ............. [2] Ran
2014_10_12_100000_create_password_resets_table ... [1] Ran
2019_08_19_000000_create_failed_jobs_table ....... [3] Ran
Note the batch numbers are not sorted.
This actually can happen quite often when working with a team on different branches.
Hopefully this PR fixes it 🙂