Skip to content

Missing unique key on eav_attribute_option_value table #24718

@tzyganu

Description

@tzyganu

This is similar to #24581 but for the table eav_attribute_option_value

Summary (*)

The table eav_attribute_option_value does not have a unique index on the column pair (option_id, store_id).
There is no reason for an option to have 2 values for the same store so this should be restricted.

Also layered navigation disappears on frontend.

Relates issues:
#24581
#24718

Examples (*)

Same as #24581, if by any faulty code an option gets 2 values for the same store view this causes a lot of issues when editing product / attributes / maybe others.

Proposed solution

add a unique key on the column pair (option_id, store_id) on the table eav_attribute_option_value

    <table name="eav_attribute_option_value">
       ......
        <constraint xsi:type="unique" referenceId="EAV_ATTRIBUTE_OPTION_VALUE_OPTION_ID_STORE_ID_UNIQUE">
            <column name="store_id"/>
            <column name="option_id"/>
        </constraint>
    </table>

Metadata

Metadata

Assignees

Labels

Area: CatalogComponent: DBIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.3.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions