0
當我嘗試激活我的自定義插件,我收到以下錯誤:WordPress的DB錯誤:多個主鍵定義
WordPress database error Multiple primary key defined for query ALTER TABLE temp CHANGE COLUMN
id
id int(11) UNSIGNED AUTO_INCREMENT PRIMARY
private function runDbMigration_20() {
$sql = "CREATE TABLE " . PREFIX . "subscribers (
id int(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name tinytext NOT NULL,
email text NOT NULL,
secretkey text NOT NULL,
random_key text NOT NULL,
onehourmailsent int(1) NOT NULL DEFAULT 0,
onedaymailsent int(1) NOT NULL DEFAULT 0,
wbstartingmailsent int(1) NOT NULL DEFAULT 0,
replaymailsent int(1) NOT NULL DEFAULT 0,
temp_id int(11) NOT NULL,
exact_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
watch_day varchar(3),
watch_time time,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
last_seen datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
active int(1) UNSIGNED NOT NULL DEFAULT 1,
high_five int(1) UNSIGNED NOT NULL DEFAULT 0,
attended int(1) UNSIGNED NOT NULL DEFAULT 0
)" . $this->CHARSET_COLLATE . ";";
return $this->calldbDelta($sql);
}
請,能有人幫助我如何解決這個問題?
問題是不是在你引用的代碼出現。該問題似乎與「ALTER TABLE」(而不是「CREATE TABLE」)和TEMPORARY表(不是永久的)有關。你的MySQL服務器記錄查詢和/或你能找到代碼在臨時表上調用ALTER TABLE的位置嗎? – barrycarter
感謝您糾正我。我將在MYSQL服務器上啓用日誌查詢,並將查找ALTER TABLE代碼所在的路徑@barrycarter – Himani