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:

screenshot

CommentFileSizeAuthor
#2 Screenshot 2025-12-10 151601.png43.34 KBjura.khrapunov
Command icon 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

jura.khrapunov created an issue. See original summary.

jura.khrapunov’s picture

Issue summary: View changes
StatusFileSize
new43.34 KB

rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Status: Active » Needs work
medha kumari’s picture

Assigned: Unassigned » medha kumari

Working on It.

medha kumari’s picture

Assigned: medha kumari » Unassigned
Status: Needs work » Needs review

rajeshreeputra’s picture

Status: Needs review » Needs work

I 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).

rajeshreeputra’s picture

media migration complete without error.

rajeshreeputra’s picture

Version: 2.1.2 » 2.x-dev
Status: Needs work » Needs review

Requesting review.

  • rajeshreeputra committed 9a005265 on 2.x
    Resolve #3562540 "Fix: integrity constraint violation error and skip...
rajeshreeputra’s picture

Status: Needs review » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.