Quantcast
Channel: Topic Tag: Database Error | WordPress.org
Viewing all articles
Browse latest Browse all 642

Throwing error

$
0
0

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’m using this plugin like this.

[23-Apr-2022 09:01:47 UTC] WordPress database error for Table 'xxx_aiowps_debug_log' already exists förfrågan CREATE TABLE xxx_aiowps_debug_log (
			id bigint(20) NOT NULL AUTO_INCREMENT,
			level varchar(25) NOT NULL DEFAULT '',
			message text NOT NULL DEFAULT '',
			type varchar(25) NOT NULL DEFAULT '',
			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
			PRIMARY KEY  (id)
			)DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

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 “CREATE TABLE” to “CREATE TABLE IF NOT EXISTS” in this section.

//This exists as a constant, but multisite will need to refresh $wpdb->prefix
		$debug_log_tbl_name = $wpdb->prefix.'aiowps_debug_log';

		$debug_log_tbl_sql = "CREATE TABLE IF NOT EXISTS " . $debug_log_tbl_name . " (
			id bigint(20) NOT NULL AUTO_INCREMENT,
			level varchar(25) NOT NULL DEFAULT '',
			message text NOT NULL DEFAULT '',
			type varchar(25) NOT NULL DEFAULT '',
			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
			PRIMARY KEY  (id)
			)" . $charset_collate . ";";

		maybe_create_table($debug_log_tbl_name, $debug_log_tbl_sql);

	}

Is this a correct solution? In that case do you consider change this in coming update?
Thank you again for this great plugin!
Best regards
Lennart


Viewing all articles
Browse latest Browse all 642

Trending Articles