I recently uploaded a large (>500) number of nodes to my 4.4 site via SQL. I used SQL rather than node_import because I needed to be able to assign taxonomy verbs to each node during the import process. I'm not yet ready to tackle something like patching node_import, until I better understand the data structures of the site content.

All the new data displays just fine. However, when I try to create a new node via the 'create content' link, I get an error that the node id already exists. There must be some place where the next node number value should be reset. Can someone perhaps offer a hint of how to do that?

Thanks!

Comments

Brian@brianpuccio.net’s picture

I'm not much help, but hopefully this will point you in the right direction. Drupal has a counter in the database for nodes. Codemonkeyx references it here where he says:

But yes there is a counter which Drupal uses to determine the next node id (and user id, comment id, term id, etc). So if you go into the sequence table in your database, try setting the node id field to your max nid + 1.

Since I'm not 100% sure if this will work or not, please back things up before changing anything by hand.

killes@www.drop.org’s picture

That counter can be found in the 'sequences' table.

Brian@brianpuccio.net’s picture

I'll remember that for future reference.

kbahey’s picture

I did something similar recently, when I wrote custom scripts to import data from an old custom made CMS to Drupal.

You have to do:

select max(nid) from node;

Then take that result

update sequences set id = 'num' where name = 'node_nid';

Where num is the result from the first SQL statement.

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba