From 5fd633b48b360de11310210d65bb15b888a79103 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 31 Jan 2012 18:26:07 +0000 Subject: [PATCH] Drop the comment_approved index from the comments table. comment_approved_date_gmt is sufficient. fixes #19935 git-svn-id: http://svn.automattic.com/wordpress/trunk@19799 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 1 - wp-admin/includes/upgrade.php | 20 ++++++++++++++------ wp-includes/version.php | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 0885d6dcad..7085e3d41d 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -103,7 +103,6 @@ CREATE TABLE $wpdb->comments ( comment_parent bigint(20) unsigned NOT NULL default '0', user_id bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (comment_ID), - KEY comment_approved (comment_approved), KEY comment_post_ID (comment_post_ID), KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), KEY comment_date_gmt (comment_date_gmt), diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index a1ceeed96c..58db1294e9 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -459,7 +459,7 @@ function upgrade_all() { if ( $wp_current_db_version < 19389 ) upgrade_330(); - if ( $wp_current_db_version < 19793 ) + if ( $wp_current_db_version < 19799 ) upgrade_340(); maybe_disable_automattic_widgets(); @@ -1224,11 +1224,19 @@ function upgrade_330() { function upgrade_340() { global $wp_current_db_version, $wpdb; - $wpdb->hide_errors(); - $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" ); - $wpdb->show_errors(); -} - + if ( $wp_current_db_version < 19798 ) { + $wpdb->hide_errors(); + $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" ); + $wpdb->show_errors(); + } + + if ( $wp_current_db_version < 19799 ) { + $wpdb->hide_errors(); + $wpdb->query("ALTER TABLE $wpdb->comments DROP INDEX comment_approved"); + $wpdb->show_errors(); + } +} + /** * Execute network level changes * diff --git a/wp-includes/version.php b/wp-includes/version.php index b8d50d2e44..99a00f4815 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -11,7 +11,7 @@ $wp_version = '3.4-alpha-19719'; * * @global int $wp_db_version */ -$wp_db_version = 19798; +$wp_db_version = 19799; /** * Holds the TinyMCE version