[wp-trac] [WordPress Trac] #34471: dbDelta fails with existing tables and indices
WordPress Trac
noreply at wordpress.org
Wed Oct 28 04:27:15 UTC 2015
#34471: dbDelta fails with existing tables and indices
----------------------------+-----------------------------
Reporter: sourcerer-mike | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 4.3.1
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Referring "wp-admin/includes/upgrade.php:2231" @WP 4.3.1
Take this Query:
{{{
CREATE TABLE wp_termmeta (
meta_id bigint(20) NOT NULL AUTO_INCREMENT,
term_id bigint(20) NOT NULL default 0,
meta_key varchar(255) DEFAULT NULL,
meta_value longtext DEFAULT NULL
)
UNIQUE KEY meta_id (meta_id)
}}}
Running it multiple times with dbDelta will fail in an invalid Query:
{{{
ALTER TABLE wp_termmeta ADD
}}}
It creates queries for indices. But as I debug the variable $indices looks
like this:
{{{
$indices = array(
1 => "",
2 => "",
);
}}}
I don't know why it is "empty" but this might be a hotfix:
{{{
$indices = array_filter($indices);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34471>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list