[development] Why does the 'name' key in {sequences} have the table prefix prepended?

Rob Thorne rob at torenware.com
Thu Feb 2 20:26:19 UTC 2006


I've no problem with the database-neutral code per se.  But a point to 
consider:  remember that unless you patch Drupal quite a bit,  if you 
change the table prefix,  the key (with the prefixed key name) is going 
to end up in another table anyway.

Think it through.  The shared sites need to have separate table 
prefixes.  Suppose you have prefix "a_" and prefix "b_".  If you prefix 
the key names, then you have a row with   a_node.name="a_node_id" in a 
table "a_node",  and a  row  with  b_node.name = 'b_node_id'  in a table 
"b_node".  How is this better than having a row with   
a_node.name="node_id" in a table "a_node",  and a  row  with  
b_node.name = 'node_id' in a table "b_node".

Both examples  should work equally well.  But the latter is easier to 
manage in installers or for transferring data.

Rob

Moshe Weitzman wrote:
>> Is there any reason why we could *not* do this?
>
> When you share tables across drupal sites, you must share the 
> sequences table and thus the ids need to be unique.
>
> if this pains you or others, I encourage you to submit a patch which 
> gets rid of drupal sequences in favor of native DB sequences.
>
> -moshe
>
>



More information about the development mailing list