[wp-hackers] dbDelta and duplicated indices (WAS: A Question On Plugins)

Jamie Talbot wphackers at jamietalbot.com
Tue Apr 25 14:00:43 GMT 2006


Andy Skelton wrote:
> If the db version in the option is outdated or missing:
> $my_queries = "CREATE TABLE foo (...); CREATE TABLE bar (...);"
> require_once(ABSPATH/wp-admin/upgrade-functions.php);
> dbDelta($my_queries);
> update your db version option.

Incidentally, (and just to hijack a little bit) does dbdelta handle multi-column primary keys?  When
the table already exists (say I'm upgrading), I get errors like "multiple key not allowed" unless I
turn errors off.  Also, it seems like UNIQUE indices are duplicated when calling dbdelta repeatedly.
-  Instead of being overwritten, they are just added, without being removed first.  I'm pretty sure
this isn't intended behaviour?  If it isn't, I'll open a ticket...  Can anyone else confirm this
behaviour for other kinds of indices?

Jamie.

--
 http://jamietalbot.com


More information about the wp-hackers mailing list