Problem/Motivation
While performing migration of a single media type "[DEPRECATED] Acquia DAM Image" (machine name: acquia_dam_image) to "Acquia DAM: Image" (machine name: acquia_dam_image_asset) using Drush command acquiadam:migrate we are consistently getting following error and attempt fails:
> [notice] The following operations has been performed on the acquia_dam_image media type during the Acquia DAM migration: renaming from “[DEPRECATED] Acquia DAM Image” to “[DEPRECATED] Acquia DAM Image”, fetch method switched to “embed”, replacing its source plugin from “acquiadam_asset” to “acquia_dam_asset:image”.
>
> In ExceptionHandler.php line 45:
>
> SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6279
> 1-0-0-en' for key 'PRIMARY': INSERT INTO "media__acquia_dam_asset_id" ("bun
> dle", "deleted", "entity_id", "revision_id", "langcode", "delta", "acquia_d
> am_asset_id_asset_id") VALUES (:db_insert_placeholder_0, :db_insert_placeho
> lder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_plac
> eholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array
> (
> [:db_insert_placeholder_0] => acquia_dam_image
> [:db_insert_placeholder_1] => 0
> [:db_insert_placeholder_2] => 62791
> [:db_insert_placeholder_3] => 62791
> [:db_insert_placeholder_4] => en
> [:db_insert_placeholder_5] => 0
> [:db_insert_placeholder_6] => 581bc840-4254-4fcd-9c57-c928b0cfbe0c
> )
>
>
> In PdoTrait.php line 115:
>
> SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6279
> 1-0-0-en' for key 'PRIMARY'
>
>
Migration config screenshot:

Comments
Comment #2
jura.khrapunov commentedComment #5
rajeshreeputraComment #6
medha kumariWorking on It.
Comment #7
medha kumariComment #9
rajeshreeputraI have tested this against several edge cases, such as when a single asset (e.g.,
65ae773e-2ace-4edb-821b-05da2b38765a) is added twice to the Acquia DAM Image media type. In this scenario, two separate media items (mid 1 and mid 2) reference the same asset.If Node 1 uses both, Node 2 uses mid 1, and Node 3 uses mid 2, skipping mid 2 during migration causes the media to disappear from Node 1 and Node 3.
Update:It will not skip media 2 migration. Both media entities will be migrated because they have different entity_id (MIDs), it will keep deduplicate media for asset (e.g.,
65ae773e-2ace-4edb-821b-05da2b38765a).Comment #10
rajeshreeputramedia migration complete without error.
Comment #11
rajeshreeputraRequesting review.
Comment #13
rajeshreeputraMerged!