• During activation WordPress is attempting to alter my table but there is no need. The alteration was already done.

    My code…

    // c2pprojects
            $sql_create_table = "CREATE TABLE {$wpdb->c2pprojects} (
                    projectid bigint(5) unsigned NOT NULL AUTO_INCREMENT,
                    projectname varchar(45) DEFAULT NULL,
                    timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    settingschange DATETIME NOT NULL DEFAULT,
                    source1 int(5) unsigned DEFAULT 0,
                    source2 int(5) unsigned DEFAULT 0,
                    source3 int(5) unsigned DEFAULT 0,
                    source4 int(5) unsigned DEFAULT 0,
                    source5 int(5) unsigned DEFAULT 0,
                    lockcontent tinyint(1) unsigned DEFAULT 0,
                    lockmeta tinyint(1) unsigned DEFAULT 0,
                    datatreatment varchar(50) DEFAULT 'single',
                    projectsettings longtext DEFAULT NULL,
                    UNIQUE KEY projectid (projectid)
                 ) $charset_collate; ";
            dbDelta( $sql_create_table );

    and here is the log entry…

    WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 for query ALTER TABLE wp_c2pprojects CHANGE COLUMN settingschange settingschange DATETIME NOT NULL DEFAULT made by activate_plugin, do_action('activate_csv-2-post/csv-2-post.php'), call_user_func_array, C2P_Install->install_plugin, C2P_Install->create_tables, dbDelta

    “settingschange settingschange” is particularly strange. Is it suggesting that it is attempting to rename the column to the original name?

    Thanks all

The topic ‘dbDelta Problem – What is wrong with this query?’ is closed to new replies.