magento / magento/data-migration-tool
Mismatch on customer entity on data migration followed by an integrity constraint violation on delta migration
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 339
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
### Preconditions
1. Source
- Magento Community Edition 1.9.0.1
2. Destination:
- Magento Community Edition 2.4.5
- Data Migration Tool 2.4.5
- MySQL 8.0
- PHP 8.1
### Steps to reproduce
1. Data migration: `bin/magento migrate:data [path to config] -r -a` with a concurrent user registration.
2. Delta migration: `bin/magento migrate:delta [path to config] -a`
### Expected result
The delta migration sync Magento 2 with the data of Magento 1
### Actual result
The delta migration fail with the SQL error:
`
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[...]@[...]-0' for key 'customer_entity.CUSTOMER_ENTITY_EMAIL_WEBSITE_ID', query was: INSERT INTO `customer_entity` (`entity_id`,`website_id`,[...]
`
### Additional notes
I'm trying to migrate a Magento 1 website (in use in production), to Magento 2.
I setup a migration plan following this documentation: https://experienceleague.adobe.com/docs/commerce-operations/tools/data-migration/how-migration-works.html?lang=en
The data migration finished successfully, but with this warning:
`
[2023-02-27T11:46:45.766434+00:00][WARNING]: Mismatch of entities in the document: customer_entity Source: 202998 Destination: 202997
`
I thought a user signed up during the migration, so I did a delta migration, but a database error stopped the process:
`
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[...]@[...]-0' for key 'customer_entity.CUSTOMER_ENTITY_EMAIL_WEBSITE_ID', query was: INSERT INTO `customer_entity` (`entity_id`,`website_id`,[...]
`
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 with the documented migration workflow and the `bin/magento migrate:data` and `bin/magento migrate:delta` entry points, using the provided Magento 1.9.0.1 to Magento 2.4.5 reproduction. Trace the `customer_entity` mismatch and the duplicate `CUSTOMER_ENTITY_EMAIL_WEBSITE_ID` error. Done means delta migration completes and synchronizes the customer data without the integrity constraint violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- data-engineering, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100