From af70c14d6d981c59ac622bc3dc1c6ef284d0ec10 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 30 Aug 2013 04:30:08 +0000 Subject: [PATCH] Add signup_id primary key to $wpdb->signups, and add better indexes. props josephscott, pento, barry. see #15004. Built from https://develop.svn.wordpress.org/trunk@25179 git-svn-id: http://core.svn.wordpress.org/trunk@25151 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 6 +++++- wp-admin/includes/upgrade.php | 5 +++++ wp-includes/version.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 4814a05d74..14304d01f0 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -272,6 +272,7 @@ CREATE TABLE $wpdb->sitemeta ( KEY site_id (site_id) ) $charset_collate; CREATE TABLE $wpdb->signups ( + signup_id bigint(20) NOT NULL auto_increment, domain varchar(200) NOT NULL default '', path varchar(100) NOT NULL default '', title longtext NOT NULL, @@ -282,8 +283,11 @@ CREATE TABLE $wpdb->signups ( active tinyint(1) NOT NULL default '0', activation_key varchar(50) NOT NULL default '', meta longtext, + PRIMARY KEY (signup_id), KEY activation_key (activation_key), - KEY domain (domain) + KEY user_email (user_email) + KEY user_login_email (user_login,user_email), + KEY domain_path (domain,path), ) $charset_collate;"; switch ( $scope ) { diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 0d17d8fce4..63a6559561 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1978,6 +1978,11 @@ function pre_schema_upgrade() { $wpdb->query("ALTER TABLE $wpdb->options DROP INDEX option_name"); } + // Upgrade verions prior to 3.7 + if ( $wp_current_db_version < 25179 && is_multisite() && is_main_network() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { + $wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" ); + $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" ); + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index f34a27ab00..4911bf2d6a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -11,7 +11,7 @@ $wp_version = '3.7-alpha-25157'; * * @global int $wp_db_version */ -$wp_db_version = 24448; +$wp_db_version = 25179; /** * Holds the TinyMCE version