cakephp / cakephp/phinx

phinx status prints down migrations out of order

Open
#1,745 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the code used by bin/phinx status and its migration ordering output; the issue does not name a source file or test. Compare the ordering of pending and completed migrations in the two reported outputs, then add coverage showing that an inserted migration is displayed in the expected order.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.