Importing with same NIDs in D8

Created on 26 July 2023, over 1 year ago
Updated 29 July 2023, over 1 year ago

Problem/Motivation

There is a similar issue as this for the D7 version of the module ( https://www.drupal.org/project/node_export/issues/1684274 β†’ ). We need to be able to import nodes with the same Node ID as was originally created, for a project we're working on as well.

Proposed resolution

I don't know if any other folks might need to use the same NIDs as we need to do, so I thought I'd throw a patch in here as a start. I don't expect this patch to be added as-is. I think it would be nice to create a new setting for the module where you could choose whether you wanted to create new nodes with the same NIDs as on the exporting system, or use totally new NIDs. I can see good reasons why you might want to do it either of those ways. This patch I'll be posting is just a quick and dirty way to patch the module so you can import with same NIDs if you like.

I realize people have commented that creating the new nodes with the same NID isn't a good practice. But what we're trying to accomplish is to create a whole bunch of new nodes of a certain content type on one of our non-prod servers, and then when they are all perfect and approved, we want to export them using the same NIDs to all the other versions of the site (i.e., the dev version, staging version, and prod version should all have the same pages with the same NIDs). We actually have several other environments as well - and need to keep the NIDs for each node the same in all environments. I realize most companies probably just create new content in their live environment, but our process is a bit different.

✨ Feature request
Status

Active

Component

Node export

Created by

πŸ‡ΊπŸ‡ΈUnited States pamelalies Minneapolis area

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

Comments & Activities

Production build 0.71.5 2024