cakephp / phinx

PHP Database Migrations for Everyone
https://phinx.org
MIT License
4.46k stars 891 forks source link

phinx status prints down migrations out of order #1745

Open MasterOdin opened 4 years ago

MasterOdin commented 4 years ago

Adding a migration to a list of existing migrations, where its id falls between existing ones, I get:

$ bin/phinx status
Phinx by CakePHP - https://phinx.org.

using config file ./phinx.yml
using config parser yml
using migration paths
 - /Users/mpeveler/Work/Github/phinx/db/migrations
using seed paths
warning no environment specified, defaulting to: mysql
ordering by creation time

 Status  [Migration ID]  Started              Finished             Migration Name
----------------------------------------------------------------------------------
     up  20190928205056  2020-04-11 16:07:50  2020-04-11 16:07:50  Migration
     up  20200411164726  2020-04-11 16:47:59  2020-04-11 16:47:59  ThirdMigration
   down  20200411160806                                            SecondMigration

I would expect the SecondMigration to be in the middle of the two, given its id and after migrating, I get:

$ bin/phinx status
Phinx by CakePHP - https://phinx.org.

using config file ./phinx.yml
using config parser yml
using migration paths
 - /Users/mpeveler/Work/Github/phinx/db/migrations
using seed paths
warning no environment specified, defaulting to: mysql
ordering by creation time

 Status  [Migration ID]  Started              Finished             Migration Name
----------------------------------------------------------------------------------
     up  20190928205056  2020-04-11 16:07:50  2020-04-11 16:07:50  Migration
     up  20200411160806  2020-04-11 16:50:54  2020-04-11 16:50:54  SecondMigration
     up  20200411164726  2020-04-11 16:50:47  2020-04-11 16:50:47  ThirdMigration
JRDuncan commented 3 years ago

@MasterOdin Looks like it orders by status then by Migration Id which kind of makes sense

dereuromark commented 3 years ago

I cannot confirm that though in current master:

     up  20201009214656  MigrationInit       
   down  20201009214657  MigrationInit2      
     up  20201014000218  MigrationLanguages  
     up  20201014000219  MigrationContinents 
     up  20201014000220  MigrationCountries  
     up  20201014000221  MigrationCities   

They seem to always be displayed by timestamp. Maybe that is migrations plugin converting that already or resorting ( https://github.com/cakephp/migrations ). But I think this is probably the most useful display, as it shows in colors anyway, so the order helps to just know about possible conflicts.