0

I'm working on migration from an old Drupal 8 site to new Drupal 9 site:
I developed a source plugin to get data from D8 database:
My migration works, but it doesn’t migrate all my contents and get this error:

Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8a7e1ba8-9b75-4813-80d6-99104c82efa5' for key 'node_field__uuid__value': INSERT INTO {node} ("vid", "type", "uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array

When I debug the issue and I have found that there is some translated nodes have the same nid vid only langcode is different like the example bellow. enter image description here

I added the langcode as id in my source plugin but it doesn't help:

  public function getIds() {
    return [
      'nid' => [
        'type' => 'integer',
        'alias' => 'n',
      ],
      'langcode' => [
        'type' => 'string',
        'alias' => 'n',
      ],
    ];
  }

How can i migrate those nodes ?
Used modules: Migrate/ Migrate plus / Migrate Tools .
Drupal Version : 9.0.3

2
  • 3
    Why to write a migration plugin? Won't the composer file update and drush updb are not enough to migrate a site for D8 to DO . Commented Aug 19, 2020 at 23:15
  • i already find the project like that, they want to initiate the project from scratch, i get they tried that way but they have a lot of modules custom and also contrib not supported by D9 yet
    – berramou
    Commented Aug 20, 2020 at 8:30

1 Answer 1

0

I have found that there is some translated nodes have the same nid vid only langcode is different enter image description here

When using translation, that's ok and normal.


However, what's never ok and not normal:

Duplicate entry '8a7e1ba8-9b75-4813-80d6-99104c82efa5' for key 'node_field__uuid__value': INSERT INTO {node} ("vid", "type", "uuid", "langcode")

Universally Unique IDentifier cannot be the same, has to be unique. The error is telling you that you have two or more nodes, in the node table, with the same UUID.

So either you have 2 or more Nodes in D8 with the same UUID or perhaps you have a node that was already migrated to D9, but your migration is failing to see that and skip it.

If both are on D8, when you find which nodes have the same/duplicate UUID, via Drupal delete one and re-create it. Just in case, check that the other one didn't get deleted as well because it had the same UUID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.