[wp-hackers] dbDelta and duplicated indices

Ryan Scheuermann ryan at concept64.com
Tue Apr 25 17:12:30 GMT 2006

Ryan Scheuermann wrote:
> Owen Winkler wrote:
>> Ryan Scheuermann wrote:
>>> Maybe if we are going to recommend plugin authors to use dbDelta, we 
>>> should have some documentation on its precise syntax?  Might benefit 
>>> those not willing to fiddle and peruse the core code until it 
>>> works?  "We" referring to the collective of WP 
>>> developers/documenters.  :-)
>> Originally, I had written it so that it would respond to the format 
>> that phpMyAdmin was producing when I asked for the database struture 
>> as SQL.  I think that's generally the SHOW CREATE TABLE format.
>> Owen
> OK, that makes sense.  I just tested a single column UNIQUE KEY with 
> this syntax and dbDelta works 100%, but with a multi-column UNIQUE 
> KEY, dbDelta does attempt to recreate the index every time even with 
> the exact phpMyAdmin syntax.
> Ryan
And actually, I just tested it again - with a single column UNIQUE KEY 
when the key already exists but you change the key column, dbDelta 
attempts to ADD the unique key index but it doesn't drop the old index 
first.  That's probably the problem.


More information about the wp-hackers mailing list