Fix typo in r97044 reported in twn
[lhc/web/wiklou.git] / maintenance / tables.sql
index 99b70e4..556fd54 100644 (file)
@@ -135,6 +135,7 @@ CREATE TABLE /*_*/user (
 
 CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name);
 CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token);
+CREATE INDEX /*i*/user_email ON /*_*/user (user_email(50));
 
 
 --
@@ -163,6 +164,15 @@ CREATE TABLE /*_*/user_groups (
 CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group);
 CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group);
 
+-- Stores the groups the user has once belonged to.
+-- The user may still belong these groups. Check user_groups.
+CREATE TABLE /*_*/user_former_groups (
+  -- Key to user_id
+  ufg_user int unsigned NOT NULL default 0,
+  ufg_group varbinary(16) NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/ufg_user_group ON /*_*/user_former_groups (ufg_user,ufg_group);
 
 --
 -- Stores notifications of user talk page changes, for the display
@@ -198,7 +208,7 @@ CREATE TABLE /*_*/user_properties (
   up_user int NOT NULL,
 
   -- Name of the option being saved. This is indexed for bulk lookup.
-  up_property varbinary(32) NOT NULL,
+  up_property varbinary(255) NOT NULL,
 
   -- Property value as a string.
   up_value blob
@@ -521,9 +531,7 @@ CREATE TABLE /*_*/categorylinks (
   -- paginate the three categories separately.  This never has to be updated
   -- after the page is created, since none of these page types can be moved to
   -- any other.
-  -- This used to be ENUM('page', 'subcat', 'file') but was changed to a
-  -- varchar because of the weird semantics of < and > when used on enums
-  cl_type varchar(6) NOT NULL default 'page'
+  cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page'
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to);
@@ -930,6 +938,57 @@ CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp
 CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
 
 
+--
+-- Store information about newly uploaded files before they're
+-- moved into the actual filestore
+--
+CREATE TABLE /*_*/uploadstash (
+       us_id int unsigned NOT NULL PRIMARY KEY auto_increment,
+
+       -- the user who uploaded the file.
+       us_user int unsigned NOT NULL,
+
+       -- file key. this is how applications actually search for the file.
+       -- this might go away, or become the primary key.
+       us_key varchar(255) NOT NULL,
+
+       -- the original path
+       us_orig_path varchar(255) NOT NULL,
+
+       -- the temporary path at which the file is actually stored
+       us_path varchar(255) NOT NULL,
+
+       -- which type of upload the file came from (sometimes)
+       us_source_type varchar(50),
+
+       -- the date/time on which the file was added
+       us_timestamp varbinary(14) not null,
+
+       us_status varchar(50) not null,
+
+       -- file properties from File::getPropsFromPath.  these may prove unnecessary.
+       --
+       us_size int unsigned NOT NULL,
+       -- this hash comes from File::sha1Base36(), and is 31 characters
+       us_sha1 varchar(31) NOT NULL,
+       us_mime varchar(255),
+       -- Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table
+       us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
+       -- image-specific properties
+       us_image_width int unsigned,
+       us_image_height int unsigned,
+       us_image_bits smallint unsigned
+
+) /*$wgDBTableOptions*/;
+
+-- sometimes there's a delete for all of a user's stuff.
+CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user);
+-- pick out files by key, enforce key uniqueness
+CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key);
+-- the abandoned upload cleanup script needs this
+CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp);
+
+
 --
 -- Primarily a summary table for Special:Recentchanges,
 -- this table contains some additional info on edits from
@@ -1032,31 +1091,6 @@ CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_ti
 CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
 
 
---
--- Used by the math module to keep track
--- of previously-rendered items.
---
-CREATE TABLE /*_*/math (
-  -- Binary MD5 hash of the latex fragment, used as an identifier key.
-  math_inputhash varbinary(16) NOT NULL,
-
-  -- Not sure what this is, exactly...
-  math_outputhash varbinary(16) NOT NULL,
-
-  -- texvc reports how well it thinks the HTML conversion worked;
-  -- if it's a low level the PNG rendering may be preferred.
-  math_html_conservativeness tinyint NOT NULL,
-
-  -- HTML output from texvc, if any
-  math_html text,
-
-  -- MathML output from texvc, if any
-  math_mathml text
-) /*$wgDBTableOptions*/;
-
-CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash);
-
-
 --
 -- When using the default MySQL search backend, page titles
 -- and text are munged to strip markup, do Unicode case folding,
@@ -1192,6 +1226,7 @@ CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_times
 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 INDEX /*i*/type_action ON /*_*/logging(log_type, log_action, log_timestamp);
 
 
 CREATE TABLE /*_*/log_search (
@@ -1435,4 +1470,78 @@ CREATE TABLE /*_*/module_deps (
 ) /*$wgDBTableOptions*/;
 CREATE UNIQUE INDEX /*i*/md_module_skin ON /*_*/module_deps (md_module, md_skin);
 
+-- Table for holding configuration changes
+CREATE TABLE /*_*/config (
+  -- Config var name
+  cf_name varbinary(255) NOT NULL PRIMARY KEY,
+  -- Config var value
+  cf_value blob NOT NULL
+) /*$wgDBTableOptions*/;
+-- 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