Problem/Motivation
Migration error out with following message:
ResponseText: The website encountered an unexpected error. Try again later.Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]:
Integrity constraint violation: 1062 Duplicate entry '55746-131111-0-0-fr' for key 'PRIMARY': INSERT INTO "media_revision__acquia_dam_asset_id"
("bundle", "deleted", "entity_id", "revision_id", "langcode", "delta", "acquia_dam_asset_id_asset_id")
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3549509-fix-issue-on-multilingual-sites-migration.patch | 753 bytes | marcos_lima |
Issue fork media_acquiadam-3549509
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
marcos_lima commentedWe had the same problem here, with the migration failing on our multilingual installation, and came to the same solution as proposed in the MR, after a round o debugging. With the fetchAllAssoc(), the code aggregates results by language and in the second loop of the batch it breaks because it tries to process a record that was already processed, since the range will be off because of the aggregation. The proposed fix worked well for our use case.
I'll attach a patch if anyone else needs a quick fix via composer patches, like we did. I'll also me moving the issue to Needs Review, but for me it is +1 vote for RTBC.
Comment #5
japerryThanks Marcos! Merged into 2.x