magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

add UNIQUE or UNQ name to unique indexes in database tables #36336

Open jakwinkler opened 2 years ago

jakwinkler commented 2 years ago

Description (*)

This table eav_attribute_label has an index defined in db_schema.xml

    <index referenceId="EAV_ATTRIBUTE_LABEL_ATTRIBUTE_ID_STORE_ID" indexType="btree">
        <column name="attribute_id"/>
        <column name="store_id"/>
    </index>

I work on fast database import scripts and tried to add a new unique index in that table:

    <table name="eav_attribute_label">
        <constraint xsi:type="unique" referenceId="EAV_ATTRIBUTE_LABEL_ATTRIBUTE_ID_STORE_ID_UNQ">
            <column name="attribute_id"/>
            <column name="store_id"/>
        </constraint>
    </table>

but unique index name create by Magento 2 is: EAV_ATTRIBUTE_LABEL_ATTRIBUTE_ID_STORE_ID which is identical to the index defined above and that breaks installation / running db:upgrade schema

Expected behavior (*)

Unique indexes should contain UNQ / UNIQUE in referenceId

Benefits

No conflicts on core tables when new indexes or unique indexes are added. Ability to create multiple insert scripts.

Additional information

m2-assistant[bot] commented 2 years ago

Hi @qsolutions-pl. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel