From: Roan Kattouw Date: Mon, 19 Jan 2009 14:12:59 +0000 (+0000) Subject: Partial redo of r45819: X-Git-Tag: 1.31.0-rc.0~43356 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=41c91237230cb13f8e028409e89041a868ef3860;p=lhc%2Fweb%2Fwiklou.git Partial redo of r45819: * rename non-PRIMARY indices that were implicitly named before r45764 back to their implicit names * add the renamed un_user_id and un_user_ip to the indexName() rewrite * use consistent casing for PRIMARY KEY --- diff --git a/includes/db/Database.php b/includes/db/Database.php index a09bcd3752..b86f35d21d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1579,8 +1579,13 @@ class Database { */ function indexName( $index ) { // Backwards-compatibility hack - if ( $index == 'ar_usertext_timestamp' ) { - return 'usertext_timestamp'; + $renamed = array( + 'ar_usertext_timestamp' => 'usertext_timestamp', + 'un_user_id' => 'user_id', + 'un_user_ip' => 'user_ip', + ); + if( isset( $renamed[$index] ) ) { + return $renamed[$index]; } else { return $index; } diff --git a/maintenance/tables.sql b/maintenance/tables.sql index dd87795d97..ba7ad96506 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -408,7 +408,7 @@ CREATE TABLE /*_*/pagelinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title); -CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); +CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from); -- @@ -427,7 +427,7 @@ CREATE TABLE /*_*/templatelinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title); -CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); +CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from); -- @@ -563,7 +563,7 @@ CREATE TABLE /*_*/langlinks ( ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang); -CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks (ll_lang, ll_title); +CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title); -- @@ -697,7 +697,7 @@ CREATE TABLE /*_*/image ( -- Filename. -- This is also the title of the associated description page, -- which will be in namespace 6 (NS_FILE). - img_name varchar(255) binary NOT NULL default '' primary key, + img_name varchar(255) binary NOT NULL default '' PRIMARY KEY, -- File size in bytes. img_size int unsigned NOT NULL default 0, @@ -838,7 +838,7 @@ CREATE TABLE /*_*/filearchive ( -- pick out by image name CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp); -- pick out dupe files -CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key); +CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key); -- sort by deletion time CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp); -- sort by uploader @@ -943,7 +943,7 @@ CREATE TABLE /*_*/watchlist ( ) /*$wgDBTableOptions*/; -CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist (wl_user, wl_namespace, wl_title); +CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title); CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title); @@ -1034,18 +1034,18 @@ CREATE TABLE /*_*/querycache ( qc_title varchar(255) binary NOT NULL default '' ) /*$wgDBTableOptions*/; -CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value); +CREATE INDEX /*i*/qc_type ON /*_*/querycache (qc_type,qc_value); -- -- For a few generic cache operations if not using Memcached -- CREATE TABLE /*_*/objectcache ( - keyname varbinary(255) NOT NULL default '' primary key, + keyname varbinary(255) NOT NULL default '' PRIMARY KEY, value mediumblob, exptime datetime ) /*$wgDBTableOptions*/; -CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime); +CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime); -- @@ -1126,7 +1126,7 @@ CREATE TABLE /*_*/job ( job_params blob NOT NULL ) /*$wgDBTableOptions*/; -CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title); +CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title); -- Details of updates to cached special pages @@ -1145,7 +1145,7 @@ CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type); -- For each redirect, this table contains exactly one row defining its target CREATE TABLE /*_*/redirect ( -- Key to the page_id of the redirect page - rd_from int unsigned NOT NULL default 0 primary key, + rd_from int unsigned NOT NULL default 0 PRIMARY KEY, -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames @@ -1231,7 +1231,7 @@ CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propnam -- A table to log updates, one text key row per update. CREATE TABLE /*_*/updatelog ( - ul_key varchar(255) NOT NULL primary key + ul_key varchar(255) NOT NULL PRIMARY KEY ) /*$wgDBTableOptions*/; -- vim: sw=2 sts=2 et