Is it possible to create new node ID's when migrating content instead of using the existing one?

ng flag

We're working on migrating a D7 site to D9 and will be creating new nodes (with new node ID's) before the site launches. The next time we sync the content from the D7 site to D9 the migration will overwrite the new nodes that we create on the new site.

Is there a way to run a migration and create new node ID's instead of using the old/existing ones?

cn flag

Just don't specify the nid in your migration yaml files. The mapping between old and new is stored in your migration_map_* database table - so wherever else you reference a node - you will need to use the entity_lookup plugin to "look up" what the new nids are.

For reference;


nid - The Drupal node ID. Usually this will be unmapped - the nid will be automatically assigned when the node is created, and the map table will record the source key that generated this ID.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.