Can someone tell me what's wrong with this function?
function xattachments_db_install() {
global $wpdb;
$xattachments_db_version = "1.0";
$table_name = $wpdb->prefix ."xattachments";
$sql = "CREATE TABLE IF NOT EXISTS ".$table_name. " (
'xattachments_id' int(10) unsigned NOT NULL,
'xattachments_name' varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
'xattachments_title' varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
'post_id' int(10) unsigned NOT NULL,
'xattachments_data_id' int(11) NOT NULL,
PRIMARY KEY ('xattachments_id')
) ENGINE=MyISAM DEFAULT CHARSET=CHARSET=utf8 COLLATE utf8_bin ;";
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
dbDelta($sql);
add_option("xattachments_db_version", $xattachments_db_version);
}
register_activation_hook(__FILE__,'xattachments_db_install');
It doesn't generate any error message when I activate the plugin but the table is not created in the database.
This function is located at the very beginning of the plugin file.
Thank you.