Table creation SQL upper cases incompatible with dbDelta
-
On every page request the plugin checks the database columns and tries to update them because of differences in upper and lower cases.
For example “tec_occurrences” is defined as:
CREATE TABLE{$table_name}(occurrence_idBIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,event_idBIGINT(20) UNSIGNED NOT NULL,post_idBIGINT(20) UNSIGNED NOT NULL,start_dateVARCHAR(19) NOT NULL,start_date_utcVARCHAR(19) NOT NULL,end_dateVARCHAR(19) NOT NULL,end_date_utcVARCHAR(19) NOT NULL,durationMEDIUMINT(30) DEFAULT 7200,hashVARCHAR(40) NOT NULL,updated_atTIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (occurrence_id) ) {$charset_collate};As you can see upper cases for BIGINT, UNSIGNED, VARCHAR etc. are being used.
The dbDelta function though uses lower cases and is case sensitive. Differences are found on every request resulting in a lot of unnecessary ALTER TABLE statements.
dbDelta then returns something like “Changed type of wp_tec_events.event_id from bigint(20) unsigned to BIGINT(20) UNSIGNED”.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Table creation SQL upper cases incompatible with dbDelta’ is closed to new replies.