Wordpress插件正在创建表


Wordpress plugin creating table

这是我第一次尝试在wordpress数据库中创建一个新表,当插件被激活时。我不会对此进行版本验证,但我稍后会添加此内容。

然而,当我的插件被激活时,我的表却没有创建?

// Setup the database
function x_install() {
    global $wpdb;
    $table_name = $wpdb->prefix . "test_data";
    $charset_collate = $wpdb->get_charset_collate();
    // Database query
    $sql = "CREATE TABLE $table_name (
      id biging(20) NOT NULL AUTO_INCREMENT,
      finn_id bigint(20) NOT NULL,
      price bigint(20) DEFAULT '0',
      title text
    ) $charset_collate;";
    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta($sql);
}
// Run database when the plugin is activated
register_activation_hook(__FILE__, 'x_install');

发现这里有错误吗?

Wordpress Codex说,

您必须使用关键字key而不是其同义词INDEX,并且必须至少包含一个KEY

http://codex.wordpress.org/Creating_Tables_with_Plugins