Fix bug 16356. Use proper normalization for dumpInterwiki.inc
[lhc/web/wiklou.git] / maintenance / tables.sql
index 4297b71..fe6f265 100644 (file)
@@ -417,6 +417,7 @@ CREATE TABLE /*_*/archive (
 
 CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
 CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
+CREATE INDEX /*i*/ar_page_revid ON /*_*/archive (ar_namespace, ar_title, ar_rev_id);
 
 
 --
@@ -575,6 +576,20 @@ CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
 CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
 
 
+--
+-- Track external user accounts, if ExternalAuth is used
+--
+CREATE TABLE /*_*/external_user (
+  -- Foreign key to user_id
+  eu_local_id int unsigned NOT NULL PRIMARY KEY,
+
+  -- Some opaque identifier provided by the external database
+  eu_external_id varchar(255) binary NOT NULL
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/eu_external_id ON /*_*/external_user (eu_external_id);
+
+
 -- 
 -- Track interlanguage links
 --
@@ -593,6 +608,24 @@ CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang);
 CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
 
 
+-- 
+-- Track inline interwiki links
+--
+CREATE TABLE /*_*/iwlinks (
+  -- page_id of the referring page
+  iwl_from int unsigned NOT NULL default 0,
+  
+  -- Interwiki prefix code of the target
+  iwl_prefix varbinary(20) NOT NULL default '',
+
+  -- Title of the target, including namespace
+  iwl_title varchar(255) binary NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title);
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
+
+
 --
 -- Contains a single row with some aggregate info
 -- on the state of the site.
@@ -750,7 +783,7 @@ CREATE TABLE /*_*/image (
   -- the minor parts are not required to adher to any standard
   -- but should be consistent throughout the database
   -- see http://www.iana.org/assignments/media-types/
-  img_minor_mime varbinary(32) NOT NULL default "unknown",
+  img_minor_mime varbinary(100) NOT NULL default "unknown",
   
   -- Description field as entered by the uploader.
   -- This is displayed in image upload history and logs.
@@ -768,9 +801,9 @@ CREATE TABLE /*_*/image (
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
--- Used by Special:Imagelist for sort-by-size
+-- Used by Special:ListFiles for sort-by-size
 CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
--- Used by Special:Newimages and Special:Imagelist
+-- Used by Special:Newimages and Special:ListFiles
 CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
 -- Used in API and duplicate search
 CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1);
@@ -802,7 +835,7 @@ CREATE TABLE /*_*/oldimage (
   oi_metadata mediumblob NOT NULL,
   oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
   oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
-  oi_minor_mime varbinary(32) NOT NULL default "unknown",
+  oi_minor_mime varbinary(100) NOT NULL default "unknown",
   oi_deleted tinyint unsigned NOT NULL default 0,
   oi_sha1 varbinary(32) NOT NULL default ''
 ) /*$wgDBTableOptions*/;
@@ -852,7 +885,7 @@ CREATE TABLE /*_*/filearchive (
   fa_bits int default 0,
   fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
   fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown",
-  fa_minor_mime varbinary(32) default "unknown",
+  fa_minor_mime varbinary(100) default "unknown",
   fa_description tinyblob,
   fa_user int unsigned default 0,
   fa_user_text varchar(255) binary,
@@ -1081,7 +1114,7 @@ CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
 CREATE TABLE /*_*/transcache (
   tc_url varbinary(255) NOT NULL,
   tc_contents text,
-  tc_time int NOT NULL
+  tc_time binary(14) NOT NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
@@ -1094,8 +1127,8 @@ CREATE TABLE /*_*/logging (
   -- Symbolic keys for the general log type and the action type
   -- within the log. The output format will be controlled by the
   -- action field, but only the type controls categorization.
-  log_type varbinary(10) NOT NULL default '',
-  log_action varbinary(10) NOT NULL default '',
+  log_type varbinary(32) NOT NULL default '',
+  log_action varbinary(32) NOT NULL default '',
   
   -- Timestamp. Duh.
   log_timestamp binary(14) NOT NULL default '19700101000000',
@@ -1103,10 +1136,14 @@ CREATE TABLE /*_*/logging (
   -- The user who performed this action; key to user_id
   log_user int unsigned NOT NULL default 0,
   
+  -- Name of the user who performed this action
+  log_user_text varchar(255) binary NOT NULL default '',
+  
   -- Key to the page affected. Where a user is the target,
   -- this will point to the user page.
   log_namespace int NOT NULL default 0,
   log_title varchar(255) binary NOT NULL default '',
+  log_page int unsigned NULL,
   
   -- Freeform text. Interpreted as edit history comments.
   log_comment varchar(255) NOT NULL default '',
@@ -1122,6 +1159,8 @@ CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
 CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
 CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
 CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
+CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp);
+CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp);
 
 
 CREATE TABLE /*_*/log_search (
@@ -1165,7 +1204,7 @@ CREATE TABLE /*_*/job (
   job_params blob NOT NULL
 ) /*$wgDBTableOptions*/;
 
-CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title);
+CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title, job_params(128));
 
 
 -- Details of updates to cached special pages
@@ -1278,11 +1317,16 @@ CREATE TABLE /*_*/updatelog (
 
 -- A table to track tags for revisions, logs and recent changes.
 CREATE TABLE /*_*/change_tag (
-  ct_rc_id int NULL, -- RCID for the change
-  ct_log_id int NULL, -- LOGID for the change
-  ct_rev_id int NULL, -- REVID for the change
-  ct_tag varchar(255) NOT NULL, -- Tag applied
-  ct_params blob NULL -- Parameters for the tag, presently unused.
+  -- RCID for the change
+  ct_rc_id int NULL,
+  -- LOGID for the change
+  ct_log_id int NULL,
+  -- REVID for the change
+  ct_rev_id int NULL,
+  -- Tag applied
+  ct_tag varchar(255) NOT NULL,
+  -- Parameters for the tag, presently unused
+  ct_params blob NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/change_tag_rc_tag ON /*_*/change_tag (ct_rc_id,ct_tag);
@@ -1295,10 +1339,14 @@ CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_i
 -- Rollup table to pull a LIST of tags simply without ugly GROUP_CONCAT
 -- that only works on MySQL 4.1+
 CREATE TABLE /*_*/tag_summary (
-  ts_rc_id int NULL, -- RCID for the change
-  ts_log_id int NULL, -- LOGID for the change
-  ts_rev_id int NULL, -- REVID for the change
-  ts_tags blob NOT NULL -- Comma-separated list of tags.
+  -- RCID for the change  
+  ts_rc_id int NULL,
+  -- LOGID for the change
+  ts_log_id int NULL,
+  -- REVID for the change
+  ts_rev_id int NULL,
+  -- Comma-separated list of tags
+  ts_tags blob NOT NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/tag_summary_rc_id ON /*_*/tag_summary (ts_rc_id);