-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "Syntax error or access violation: Duplicate key name" If we app… #38143
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @Abdul-Majid10. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
…y fulltext index and unique constraint on same column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Abdul-Majid10,
Thank you for your contribution!
I think it's a really good Pull Request, however there are some points that I am worry about.
Imagine that PR will be merged to Magento codebase and released in new versions.
Anyone who will update to that Magento version and receive these changes would face next steps (during setup:upgrade call):
- All MySQL indexes will be dropped and created again with new name (that may cause issues for merchants with giant DB or those who has some data inconsistency in the DB).
- New index name won't be whitelisted in
etc/db_schema_whitelist.json
files.
So I may suggest 2 options:
- Design and create some logic that would generate index name in a backward compatibility way (e.g. won't generate new name for already existing indexes or generate new name for an index if same name already occupied.
- Update all available
etc/db_schema_whitelist.json
and add new index name (that would require changes in other repositories). Also, it may require additional approve procedure as changes would introduce BC breaks.
Hi @swnsma, The solution involves adding a 4th argument (bool $includePrefix = false) to the getIndexName function. When its value is true, we can concatenate the prefix, similar to this. Note: We can only pass includePrefix true when Key already created for other index. This is just draft to discuss the solution. @swnsma, Looking forward to your response. |
Hi @Abdul-Majid10, I would only ask to consider:
Think that I don't like is that right now we generate index name based on the current DB state.
What do you think? |
@Abdul-Majid10, Actually, I have even better point to discuss: |
…ly fulltext index and unique constraint on same column.
Description (*)
I have fixed the issue where applying a full-text index and a unique constraint on the same column was causing an error in Magento. The problem has been resolved, and this pull request includes the necessary changes to make this combination work seamlessly.
Error Detail:
Schema File:

Error:

Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)