Support » Plugin: HyperDB » dbDelta issues w/ HyperDB

  • I’ve run into an issue where in certain situations, plugin database tables are not getting upgraded via the dbDelta function. The issue is that dbDelta runs SHOW TABLES and then loops through those tables. HyperDB sees SHOW TABLES and doesn’t know how to extract the database from that query, so it uses the global database. That means dbDelta mistakenly thinks that the table does not exist, so it tries to create it instead of altering an existing table.

    I have managed to get around the problem by hacking wp-admin/includes/upgrade.php, but it’s not ideal. Basically, I’ve set it up to call SHOW TABLE STATUS LIKE '$table' on each table in the $cqueries array (rather than just one SHOW TABLES query), which means it’s slower. But I can’t really see another way around that. One implication of HyperDB is that any table could be on any server, so I think each table needs to be checked individually.

    I’m thinking about creating a ticket and a patch for WordPress, but before I go there I was hoping someone else might have run across this problem and have a better solution.

Viewing 1 replies (of 1 total)
  • I don’t have anything smart to add, other than that I’m facing the same problem with SharDB (which is a fork of HyperDB, I think). I’ll post back if I can find a decent solution.

Viewing 1 replies (of 1 total)
  • The topic ‘dbDelta issues w/ HyperDB’ is closed to new replies.