[development] Unique/Random IDs and drupal

Earnie Boyd earnie at users.sourceforge.net
Mon Aug 11 12:38:14 UTC 2008


Quoting Robert Douglass <rob at robshouse.net>:

> I could export my blog posts from one site and import them into  
> another site and keep the id.

You could "keep the id" but IMO you shouldn't.  You don't know if there 
may be an existing id in the receiving DB.  The ID is unique to each DB 
and existing values should not be merged from one DB into another.  
That said, the only correct method for merging data from one DB into 
another is to use the API for the receiving DB so that the foreign key 
constraints match appropriately (even for those DB engines not 
supporting foreign key constraints).  In Drupal's case the nid should 
be removed so that a new nid is created or the uid should be removed so 
that a new uid is created.  An import/export API should take into 
consideration this fact and allow for the removal of the ID columns on 
import or export.

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/



More information about the development mailing list