Broken DB Schema Upgrade Code in 3.1.81
-
// check if select captcha type fields exist
$selectCaptchaType = 'selectCaptchaType';
$result = $wpdb->query( $wpdb->prepare( "SHOW COLUMNS FROM$table_name
LIKE %s ", $selectCaptchaType ) ); // db call ok; no-cache ok.
$queryExecuted = false;
if ( empty( $result ) ) {
$alter_query = "ALTER TABLE " . $table_name . "
ADD COLUMN selectCaptchaType int(1) NOT NULL DEFAULT 0 After gCaptcha_site,
ADD COLUMN cCaptchaType int(1) NOT NULL DEFAULT 0 After selectCaptchaType,
ADD COLUMN cCaptcha_secret varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER selectCaptchaType,
ADD COLUMN cCaptcha_site varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER cCaptcha_secret;
ADD COLUMN cCaptchaStyle varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER cCaptcha_site;
";
$wpdb->query( $alter_query );
$queryExecuted = true;
}Notice how there might be a problem here?
WordPress database error:?[You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ADD COLUMN cCaptchaStyle varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode...' at line 6]
ALTER TABLE wp_sib_model_forms ADD COLUMN selectCaptchaType int(1) NOT NULL DEFAULT 0 After gCaptcha_site, ADD COLUMN cCaptchaType int(1) NOT NULL DEFAULT 0 After selectCaptchaType, ADD COLUMN cCaptcha_secret varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER selectCaptchaType, ADD COLUMN cCaptcha_site varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER cCaptcha_secret; ADD COLUMN cCaptchaStyle varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci AFTER cCaptcha_site;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.