prefix . 'aieo_gsc_daily'; $charset_collate = function_exists( 'aieo_get_charset_collate' ) ? aieo_get_charset_collate() : $wpdb->get_charset_collate(); $wpdb->query( "CREATE TABLE IF NOT EXISTS {$table} ( `date` date NOT NULL, `dim_type` varchar(8) NOT NULL DEFAULT 'query', `dim_hash` char(32) NOT NULL, `dim_value` varchar(191) NOT NULL DEFAULT '', `clicks` int unsigned NOT NULL DEFAULT 0, `impressions` int unsigned NOT NULL DEFAULT 0, `ctr` decimal(6,5) NOT NULL DEFAULT 0, `position` decimal(6,2) NOT NULL DEFAULT 0, `object_type` varchar(32) NOT NULL DEFAULT '', `object_id` bigint unsigned NOT NULL DEFAULT 0, `created_at` datetime NOT NULL, PRIMARY KEY (`date`, `dim_type`, `dim_hash`) ) {$charset_collate};" ); if ( function_exists( 'aieo_create_index_if_not_exists' ) ) { aieo_create_index_if_not_exists( 'aieo_gsc_idx_series', $table, '(`dim_type`, `dim_hash`, `date`)' ); aieo_create_index_if_not_exists( 'aieo_gsc_idx_date', $table, '(`date`)' ); aieo_create_index_if_not_exists( 'aieo_gsc_idx_object', $table, '(`object_type`, `object_id`)' ); aieo_create_index_if_not_exists( 'aieo_gsc_idx_top', $table, '(`dim_type`, `date`, `impressions`)' ); } } function aieo_gsc_history_install_schema() { aieo_gsc_history_create_table(); }