Index columns order ignored for hasIndex
Open
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
Phinx doesn't check the index column order when checking if a table has an index present, using the Table::hasIndex method. An index with columns ['foo','bar'] is not the same as another with columns ['bar','foo'], but as the underlying check involves an array_diff, the order is ignored.
I'm using the MySQL adapter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Table::hasIndex and trace the underlying check used by the MySQL adapter. Compare indexes with columns ['foo','bar'] and ['bar','foo'], then add or update coverage so column order is respected and run the relevant test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100