prefix . 'ailm_click_stats'; } public static function create_table() { global $wpdb; $table_name = self::get_table_name(); $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE IF NOT EXISTS $table_name ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, post_id bigint(20) unsigned NOT NULL, target_url varchar(2048) NOT NULL, anchor text NOT NULL, click_date date NOT NULL, click_count int(11) unsigned NOT NULL DEFAULT 1, link_type varchar(20) NOT NULL DEFAULT 'internal', PRIMARY KEY (id), UNIQUE KEY unique_stat (post_id, target_url(190), anchor(190), click_date, link_type), KEY click_date (click_date) ) $charset_collate;"; if (!function_exists('dbDelta')) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } dbDelta($sql); } }