I need to import content from one site to another with completely same nid values. Can I do it with this module?

Comments

kmajzlik’s picture

NO.

danielb’s picture

Of course you can. The new imported node will be assigned a new nid, unless it has the same UUID as an existing node - in which case you can choose whether to create a new node, create a revision on the existing node, or skip the import. UUID is used by this module to identify a node, as nids are unreliable (different site can have different nids).

danielb’s picture

Unless you meant you wanted to preserve nids in the import, in which case, no... but the real question then becomes why would you want this, and perhaps finding a way to address that problem.

danielb’s picture

Status: Active » Fixed

Basically here's the deal: nids are automatically created by the database, there isn't really a way around it unless you want to get real hacky about it. While nids are the primary identifier for a node, when you get into a situation where you're dealing with content across multiple sites, nids become trouble and cannot be used to identify a node. In my experience the best way to identify a node is with UUID. It would be nice if it UUID was built into Drupal nodes by default, but it is not. So what you have to do is figure out how things on your site interconnect with each other, and if it's by nid, then that's gonna have to change - at least temporarily - to UUID.
That's how node export works when it needs to point to another node by nid - temporarily replace the relationship with UUID - then restore the nid relationship based on the new ids.
Hope this gives you some ideas.

Status: Fixed » Closed (fixed)

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

brandy.brown’s picture

Issue summary: View changes

The problem is that this module does not completely work. Therefore, some people need to pull actual database tables to make up for content that this module cannot migrate. It makes zero sense why it would change the NID. NIDs are not unreliable. You can insert NIDs the same way that you're inserting all the other data.

brandy.brown’s picture

Status: Closed (fixed) » Closed (works as designed)

I'm marking this as works as designed since you did not FIX anything. Instead, you simply said NO. I just moved on to use a different module since this one is not comprehensive and does not work properly.

ngocketit’s picture

Has anybody figured out how to do it yet? Is updating the node ID after importing ok?

killwaffles’s picture

In dire need of this functionality! I have an old D6 site that was brought to D7 just to be able to migrate the content over to another D7 site that was worked on by some predecessors that left ZERO documentation on there initial migration process. The one thing I know for certain is that the NID's match up perfectly. There are also view contextual references which depend on entirely on an NID.

szubkov’s picture

Maybe my solution would be helpful:

(drupal 7)

/**
 * Implements hook_node_export_import_alter().
 */
function MODULENAME_node_export_node_import_alter(&$node, &$original_node, &$save_node) {
  $node->nid = $original_node->nid;
  $node->is_new = TRUE;
  $node = node_submit($node);
  node_save($node);
}
candelas’s picture

Thanks @FeintEars ;) It works!

droddis’s picture

this little custom module worked great! Thanks very much @FeintEars

howdytom’s picture

@FeintEars: Thank you for sharing. This is exactly what I was looking for d7 1:1 migration. It's working like a charm.