We are testing to convert to drupal from an outdated phpnuke. An up to date version of phpnuke would be the best and an easy way. But we like to give drupal a chance.

We importet over 6000 nodes, over 1000 users and much more with a sql import. And we changed the obvious node number to the new value. In vain. When we try to save a new posting we get something like:

* user warning: Duplicate entry '3' for key 2 query: INSERT INTO node (nid, vid, title, type, uid, status, created, changed, comment, promote, moderate, sticky) VALUES (6009, 3, '....

Is it the vid value we need to change too?

What counters need to be adapt after an sql import?

Thank you in advance for any help,
Ralf

Comments

benofsky’s picture

Correct me somebody if I'm wrong but I'd say you need to change the Auto Increment value of the mysql table contaning nodes so that the next one starts at 6001 then it will automatically go up to 6002, etc.
Ben
Benofsky Park.com

Michael M’s picture

You should probably use the node_save function. Don't just use pure SQL unless you know the drupal db very well.

Drupal doesn't use auto_increment on columns. It stores that data in a table. (cross-database compatability)

You should try to change the table with the auto-increment values and see if it works. If not, you need to redo this.

http://api.drupal.org/api/HEAD/function/node_save

----
http://PointHomes.com

jtheodas’s picture

In the sequences table there are 2 fields. name and id.
You should see a record with name = node_id and id = some number.

Now, look for record with the largest nid (node id) in your node table.

Then update the sequences table and set the field 'id' to that number.

Now when you go to create a new page, Drupal will read that number from the sequences table, increment it and use it as the next nid.

Tada!

maritzaj’s picture

I found that I also needed to update the value for node_revisions_vid. This should be the same value as node_nid.