WordPress 插件创建 table

Wordpress plugin creating table

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

但是,当我的插件被激活时,我的table没有被创建?

// 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 说,

You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY.

http://codex.wordpress.org/Creating_Tables_with_Plugins