The famous dbDelta() function in WordPress is causing me problems in multiple plugins. No change I make to my create table query seems to fix the problem or it does fix it and dbDelta() causes a different error after the change.
Advice on these specific CREATE TABLE queries would be appreciated a lot.
[21-Oct-2016 23:01:29 UTC] WordPress database error Incorrect index name '' for query ALTER TABLE wp_webtechglobal_schedule ADD UNIQUE KEY `` (rowid
)
$sql_create_table = "CREATE TABLE " . $wpdb->prefix . "webtechglobal_schedule (
rowid bigint(20) unsigned NOT NULL AUTO_INCREMENT,
timesapplied bigint(20) unsigned NOT NULL DEFAULT 0,
plugin varchar(125) DEFAULT NULL,
pluginname varchar(125) DEFAULT NULL,
class varchar(250) DEFAULT NULL,
method varchar(30) DEFAULT NULL,
lastupdate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
recurrence varchar(20) DEFAULT NULL,
basepath varchar(250) DEFAULT NULL,
active tinyint(1) unsigned NOT NULL DEFAULT 1,
lastexecuted timestamp NULL,
lastcron timestamp NULL,
weight int(2) NOT NULL DEFAULT 5,
delay int(4) NOT NULL DEFAULT 3600,
firsttime timestamp NULL,
UNIQUE KEY (rowid) ) $charset_collate; ";
WordPress database error Incorrect index name '' for query ALTER TABLE wp_webtechglobal_socialaccounts ADD UNIQUE KEY `` (rowid
) made by activate_plugin
$sql_create_table = "CREATE TABLE " . $wpdb->prefix . "webtechglobal_socialaccounts (
rowid bigint(20) unsigned NOT NULL AUTO_INCREMENT,
active tinyint(1) unsigned NOT NULL DEFAULT 1,
wpuserid bigint(20) unsigned NOT NULL DEFAULT 0,
screenname varchar(45) UNIQUE,
consumer_key varchar(90) DEFAULT NULL,
consumer_secret varchar(90) DEFAULT NULL,
access_token varchar(90) DEFAULT NULL,
access_token_secret varchar(90) DEFAULT NULL,
passcode varchar(50) DEFAULT NULL,
profileurl varchar(500),
UNIQUE KEY (rowid) ) $charset_collate; ";