magento / data-migration-tool

Magento Data Migration Tool
https://devdocs.magento.com/guides/v2.3/migration/bk-migration-guide.html
Open Software License 3.0
336 stars 200 forks source link

magento/module-catalog/Setup/Patch/Data/UpdateMultiselectAttributesBackendTypes.php breaks upgrade in migrated sites from 1.x #919

Open engcom-Bravo opened 11 months ago

engcom-Bravo commented 11 months ago

Preconditions and environment

Steps to reproduce

To replicate this you need

  1. Magento 2 (e.g. 2.4.1) that was migrated from 1.x and the 1.x instance had multiselect attributes with data (stored in _text table)
  2. Use data migration tool to transfer the data which will copy the values from _text table to _varchar table during migration
  3. Upgrade to 2.4.6-p2

The system will try to copy data from the _varchar table back to the _text table which was already migrated with the data migration tool to _text and to _varchar table. In the process you'll get this error about duplicate values

Expected result

Upgrade occurs properly

Actual result

Duplicated values throw exceptions

image

Additional information

There is only one real solution here, the patch needs to first clear the invalid data from _text table before migrating from _varchar to _text

e.g.

delete from catalog_product_entity_text where catalog_product_entity_text.attribute_id in (select eav_attribute.attribute_id from eav_attribute where eav_attribute.backend_type = 'varchar' and eav_attribute.entity_type_id = 4)

Release note

No response

Triage and priority

m2-assistant[bot] commented 11 months ago

Hi @engcom-Bravo. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.