[wp-trac] [WordPress Trac] #10693: Bug in dbDelta
WordPress Trac
wp-trac at lists.automattic.com
Fri Oct 21 13:26:28 UTC 2011
#10693: Bug in dbDelta
--------------------------+-----------------------------
Reporter: arena | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Database | Version: 2.8.5
Severity: major | Resolution:
Keywords: dev-feedback |
--------------------------+-----------------------------
Comment (by arena):
This code :
{{{
$queries = array();
$queries[] =
"CREATE TABLE $wpdb->mp_tracks (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id bigint(20) NOT NULL default '0',
mail_id bigint(20) NOT NULL default '0',
tmstp timestamp NOT NULL default '0000-00-00 00:00:00',
mmeta_id bigint(20) NOT NULL default '0',
context varchar(20) NOT NULL default 'html',
ip varchar(100) NOT NULL default '',
agent varchar(255) NOT NULL default '',
track longtext,
referrer longtext,
PRIMARY KEY (id),
UNIQUE KEY id (id),
KEY user_id (user_id),
KEY mail_id (mail_id),
KEY mmeta_id (mmeta_id)
) $charset_collate;";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($queries);
}}}
gives this :
{{{
<p class='wpdberror'><strong>WordPress database error:</strong> [Multiple
primary key defined]<br />
<code>ALTER TABLE wp_mailpress_tracks ADD PRIMARY KEY (id)</code></p>
</div><div id='error'>
<p class='wpdberror'><strong>WordPress database error:</strong> [Duplicate
key name 'user_id']<br />
<code>ALTER TABLE wp_mailpress_tracks ADD KEY user_id
(user_id)</code></p>
</div><div id='error'>
<p class='wpdberror'><strong>WordPress database error:</strong> [Duplicate
key name 'mail_id']<br />
<code>ALTER TABLE wp_mailpress_tracks ADD KEY mail_id
(mail_id)</code></p>
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10693#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list