I have convert my old database to drupal. I use phpmyadmin to insert some row in node table in drupal database, i also insert the some row (with the same nid in to node_revisions table). the problem is when i creating new node in drupal, the error occur: dulicate nid... But when i delete rows that i insert it 2 tables node and node_revisions, it work ok.
how do i solve that?

Comments

Scott Reynolds’s picture

This happens because drupal uses a sequence table that stores the next nid (and next comment id, next term id etc).

So you need to update the sequences table via this sql:

UPDATE sequences SET id = <HIGHEST NID + 1> WHERE name = 'node_nid' OR name = 'node_revisions_vid';

That should fix it.

square_rinoa84’s picture

manythanks for your help. i'll try and i think this should fix this.

rivena’s picture

For those interested in a more detailed step by step explanation, there's a page in the handbook:

http://drupal.org/node/69722

Anisa.

-----------------------------------------------------------
Kindness builds stronger bonds than necessity.

www.animecards.org - 18,000 card scans and counting!
-----------------------------------------------------------