revert r102636
[lhc/web/wiklou.git] / maintenance / tables.sql
index bacf6ce..a4e107a 100644 (file)
@@ -152,7 +152,7 @@ CREATE TABLE /*_*/user_groups (
   -- with particular permissions. A user will have the combined
   -- permissions of any group they're explicitly in, plus
   -- the implicit '*' and 'user' groups.
-  ug_group varbinary(16) NOT NULL default ''
+  ug_group varbinary(32) NOT NULL default ''
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group);
@@ -265,7 +265,7 @@ CREATE TABLE /*_*/page (
 CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
 CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
 CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
-
+CREATE INDEX /*i*/page_redirect_namespace_len ON /*_*/page (page_is_redirect, page_namespace, page_len);
 
 --
 -- Every edit of a page creates also a revision row.
@@ -273,6 +273,7 @@ CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
 -- to the text storage backend.
 --
 CREATE TABLE /*_*/revision (
+  -- Unique ID to identify each revision
   rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
 
   -- Key to page_id. This should _never_ be invalid.
@@ -296,14 +297,14 @@ CREATE TABLE /*_*/revision (
   -- Text username or IP address of the editor.
   rev_user_text varchar(255) binary NOT NULL default '',
 
-  -- Timestamp
+  -- Timestamp of when revision was created
   rev_timestamp binary(14) NOT NULL default '',
 
   -- Records whether the user marked the 'minor edit' checkbox.
   -- Many automated edits are marked as minor.
   rev_minor_edit tinyint unsigned NOT NULL default 0,
 
-  -- Not yet used; reserved for future changes to the deletion system.
+  -- Restrictions on who can access this revision
   rev_deleted tinyint unsigned NOT NULL default 0,
 
   -- Length of this revision in bytes
@@ -311,7 +312,10 @@ CREATE TABLE /*_*/revision (
 
   -- Key to revision.rev_id
   -- This field is used to add support for a tree structure (The Adjacency List Model)
-  rev_parent_id int unsigned default NULL
+  rev_parent_id int unsigned default NULL,
+
+  -- SHA-1 text content hash in base-36
+  rev_sha1 varbinary(32) NOT NULL default ''
 
 ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
 -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit
@@ -418,7 +422,10 @@ CREATE TABLE /*_*/archive (
   ar_page_id int unsigned,
 
   -- Original previous revision
-  ar_parent_id int unsigned default NULL
+  ar_parent_id int unsigned default NULL,
+
+  -- SHA-1 text content hash in base-36
+  ar_sha1 varbinary(32) NOT NULL default ''
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
@@ -991,6 +998,8 @@ CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp);
 CREATE TABLE /*_*/recentchanges (
   rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
   rc_timestamp varbinary(14) NOT NULL default '',
+
+  -- This is no longer used
   rc_cur_time varbinary(14) NOT NULL default '',
 
   -- As in revision
@@ -1010,6 +1019,7 @@ CREATE TABLE /*_*/recentchanges (
   -- default view.
   rc_bot tinyint unsigned NOT NULL default 0,
 
+  -- Set if this change corresponds to a page creation
   rc_new tinyint unsigned NOT NULL default 0,
 
   -- Key to page_id (was cur_id prior to 1.5).
@@ -1023,8 +1033,10 @@ CREATE TABLE /*_*/recentchanges (
   -- rev_id of the prior revision, for generating diff links.
   rc_last_oldid int unsigned NOT NULL default 0,
 
-  -- These may no longer be used, with the new move log.
+  -- The type of change entry (RC_EDIT,RC_NEW,RC_LOG)
   rc_type tinyint unsigned NOT NULL default 0,
+
+  -- These may no longer be used, with the new move log.
   rc_moved_to_ns tinyint unsigned NOT NULL default 0,
   rc_moved_to_title varchar(255) binary NOT NULL default '',
 
@@ -1235,17 +1247,6 @@ CREATE UNIQUE INDEX /*i*/ls_field_val ON /*_*/log_search (ls_field,ls_value,ls_l
 CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
 
 
-CREATE TABLE /*_*/trackbacks (
-  tb_id int PRIMARY KEY AUTO_INCREMENT,
-  tb_page int REFERENCES /*_*/page(page_id) ON DELETE CASCADE,
-  tb_title varchar(255) NOT NULL,
-  tb_url blob NOT NULL,
-  tb_ex text,
-  tb_name varchar(255)
-) /*$wgDBTableOptions*/;
-CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page);
-
-
 -- Jobs performed by parallel apache threads or a command-line daemon
 CREATE TABLE /*_*/job (
   job_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -1474,68 +1475,4 @@ CREATE TABLE /*_*/config (
 -- Should cover *most* configuration - strings, ints, bools, etc.
 CREATE INDEX /*i*/cf_name_value ON /*_*/config (cf_name,cf_value(255));
 
--- Table tracking interwiki transclusions in the spirit of templatelinks.
--- This table tracks transclusions of this wiki's templates on another wiki
--- The gtl_from_* fields describe the (remote) page the template is transcluded from
--- The gtl_to_* fields describe the (local) template being transcluded
-CREATE TABLE /*_*/globaltemplatelinks (
-  -- The wiki ID of the remote wiki
-  gtl_from_wiki varchar(64) NOT NULL,
-
-  -- The page ID of the calling page on the remote wiki
-  gtl_from_page int unsigned NOT NULL,
-
-  -- The namespace of the calling page on the remote wiki
-  -- Needed for display purposes, since the foreign namespace ID doesn't necessarily match a local one
-  -- The link between the namespace and the namespace name is made by the globalnamespaces table
-  gtl_from_namespace int NOT NULL,
-
-  -- The title of the calling page on the remote wiki
-  -- Needed for display purposes
-  gtl_from_title varchar(255) binary NOT NULL,
-
-  -- The interwiki prefix of the wiki that hosts the transcluded page
-  gtl_to_prefix varchar(32) NOT NULL,
-
-  -- The namespace of the transcluded page on that wiki
-  gtl_to_namespace int NOT NULL,
-
-  -- The namespace name of transcluded page
-  -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
-  gtl_to_namespacetext varchar(255) NOT NULL,
-
-  -- The title of the transcluded page on that wiki
-  gtl_to_title varchar(255) binary NOT NULL
-) /*$wgDBTableOptions*/;
-
-CREATE UNIQUE INDEX /*i*/gtl_to_from ON /*_*/globaltemplatelinks (gtl_to_prefix, gtl_to_namespace, gtl_to_title, gtl_from_wiki, gtl_from_page);
-CREATE UNIQUE INDEX /*i*/gtl_from_to ON /*_*/globaltemplatelinks (gtl_from_wiki, gtl_from_page, gtl_to_prefix, gtl_to_namespace, gtl_to_title);
-
--- Table listing distant wiki namespace texts.
-CREATE TABLE /*_*/globalnamespaces (
-  -- The wiki ID of the remote wiki
-  gn_wiki varchar(64) NOT NULL,
-
-  -- The namespace ID of the transcluded page on that wiki
-  gn_namespace int NOT NULL,
-
-  -- The namespace text of transcluded page
-  -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
-  gn_namespacetext varchar(255) NOT NULL
-
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/gn_index ON /*_*/globalnamespaces (gn_wiki, gn_namespace, gn_namespacetext);
-
--- Table associating distant wiki IDs with their interwiki prefixes.
-CREATE TABLE /*_*/globalinterwiki (
-  -- The wiki ID of the wiki
-  giw_wikiid varchar(64) NOT NULL,
-
-  -- The interwiki prefix of that wiki
-  giw_prefix varchar(32) NOT NULL
-
-) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/giw_index ON /*_*/globalinterwiki (giw_wikiid, giw_prefix);
-
-
 -- vim: sw=2 sts=2 et