Auto increment instead of fixed ids

Created on 10 May 2022, over 2 years ago
Updated 3 April 2024, 9 months ago

Problem/Motivation

Currently when importing nodes (and all other content) it will get the id as specified in the json. It would be better if the imported nodes/paragraphs/files/... will have a new id based on the auto increment. It will prevent nodes from being overwritten by the import or errors raised by the import.

Proposed resolution

Do not 'migrate' the nid from nodes, fid from files etc. but let Drupal give them a new id.

Fields that are referencing other entities (like paragraph or media fields) should do a lookup of the id in the migration mapping tables to find the destination id based on the source id from the json. Something like;

  field_paragraphs:
    plugin: sub_process
    source: paragraphs
    process:
      target_id:
        plugin: migration_lookup
        migration:
          - paragraph_image
          - paragraph_text
        source: id
      target_revision_id: '@target_id'
✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands Rik Wijnen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States EthanT Sarasota, Florida

    Hey @huzooka. What about using the uuid instead of the nid for mapping? Chances of a collision would be far less likely.

Production build 0.71.5 2024