{"id":15741015,"date":"2022-06-15T19:33:13","date_gmt":"2022-06-15T19:33:13","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/throwing-error-4\/"},"modified":"2022-06-15T19:33:13","modified_gmt":"2022-06-15T19:33:13","slug":"throwing-error-4","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/throwing-error-4\/","title":{"rendered":"Throwing error"},"content":{"rendered":"<p>Hello and thanks for this great plugin! Since a couple of updates ago my error log was filled with the same error for the 3 sites where i&#8217;m using this plugin like this.<\/p>\n<pre><code>[23-Apr-2022 09:01:47 UTC] WordPress database error for Table &#039;xxx_aiowps_debug_log&#039; already exists f\u00f6rfr\u00e5gan CREATE TABLE xxx_aiowps_debug_log (\n\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\tlevel varchar(25) NOT NULL DEFAULT &#039;&#039;,\n\t\t\tmessage text NOT NULL DEFAULT &#039;&#039;,\n\t\t\ttype varchar(25) NOT NULL DEFAULT &#039;&#039;,\n\t\t\tcreated datetime NOT NULL DEFAULT &#039;1000-10-10 10:00:00&#039;,\n\t\t\tPRIMARY KEY  (id)\n\t\t\t)DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;<\/code><\/pre>\n<p>I have googled around to find a solution and it seems that i manage to get rid of this error by changing in the wp-securtity-debug-logger.php file from &#8220;CREATE TABLE&#8221; to &#8220;CREATE TABLE IF NOT EXISTS&#8221; in this section.<\/p>\n<pre><code>\/\/This exists as a constant, but multisite will need to refresh $wpdb-&gt;prefix\n\t\t$debug_log_tbl_name = $wpdb-&gt;prefix.&#039;aiowps_debug_log&#039;;\n\n\t\t$debug_log_tbl_sql = &quot;CREATE TABLE IF NOT EXISTS &quot; . $debug_log_tbl_name . &quot; (\n\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\tlevel varchar(25) NOT NULL DEFAULT &#039;&#039;,\n\t\t\tmessage text NOT NULL DEFAULT &#039;&#039;,\n\t\t\ttype varchar(25) NOT NULL DEFAULT &#039;&#039;,\n\t\t\tcreated datetime NOT NULL DEFAULT &#039;1000-10-10 10:00:00&#039;,\n\t\t\tPRIMARY KEY  (id)\n\t\t\t)&quot; . $charset_collate . &quot;;&quot;;\n\n\t\tmaybe_create_table($debug_log_tbl_name, $debug_log_tbl_sql);\n\n\t}<\/code><\/pre>\n<p>Is this a correct solution? In that case do you consider change this in coming update?<br \/>\nThank you again for this great plugin!<br \/>\nBest regards<br \/>\nLennart <\/p>\n","protected":false},"template":"","class_list":["post-15741015","topic","type-topic","status-publish","hentry","topic-tag-database-error"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15741015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15741015\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15741015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}