Branch merge of preferences work branch. Includes fixes for several bugs. WARNING...
[lhc/web/wiklou.git] / maintenance / tables.sql
index 7329603..6621041 100644 (file)
@@ -86,6 +86,7 @@ CREATE TABLE /*_*/user (
   
   -- Newline-separated list of name=value defining the user
   -- preferences
+  -- Now obsolete in favour of user_properties table.
   user_options blob NOT NULL,
   
   -- This is a timestamp which is updated when a user
@@ -611,7 +612,7 @@ CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
 -- Stores an ID for every time any article is visited;
 -- depending on $wgHitcounterUpdateFreq, it is
 -- periodically cleared and the page_counter column
--- in the page table updated for the all articles
+-- in the page table updated for all the articles
 -- that have been visited.)
 --
 CREATE TABLE /*_*/hitcounter (
@@ -966,7 +967,7 @@ CREATE TABLE /*_*/math (
   math_html text,
   
   -- MathML output from texvc, if any
-  math_mathml text  
+  math_mathml text
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash);
@@ -1199,9 +1200,9 @@ CREATE TABLE /*_*/page_restrictions (
 ) /*$wgDBTableOptions*/;
 
 CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
-CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
-CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level);
-CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade);
+CREATE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
+CREATE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level);
+CREATE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade);
 
 
 -- Protected titles - nonexistent pages that have been protected
@@ -1234,36 +1235,47 @@ CREATE TABLE /*_*/updatelog (
   ul_key varchar(255) NOT NULL PRIMARY KEY
 ) /*$wgDBTableOptions*/;
 
---- A table to track tags for revisions, logs and recent changes.
-REATE TABLE /*_*/change_tag (
-       ct_rc_id int NULL,
-       ct_log_id int NULL,
-       ct_rev_id int NULL,
-       ct_tag varchar(255) NOT NULL,
-       ct_params BLOB NULL,
-
-       UNIQUE KEY (ct_rc_id,ct_tag),
-       UNIQUE KEY (ct_log_id,ct_tag),
-       UNIQUE KEY (ct_rev_id,ct_tag),
-       KEY (ct_tag,ct_rc_id,ct_rev_id,ct_log_id) -- Covering index, so we can pull all the info only out of the index.
+
+-- A table to track tags for revisions, logs and recent changes.
+CREATE TABLE /*_*/change_tag (
+  ct_rc_id int NULL,
+  ct_log_id int NULL,
+  ct_rev_id int NULL,
+  ct_tag varchar(255) NOT NULL,
+  ct_params blob NULL
 ) /*$wgDBTableOptions*/;
 
+CREATE UNIQUE INDEX /*i*/change_tag_rc_tag ON /*_*/change_tag (ct_rc_id,ct_tag);
+CREATE UNIQUE INDEX /*i*/change_tag_log_tag ON /*_*/change_tag (ct_log_id,ct_tag);
+CREATE UNIQUE INDEX /*i*/change_tag_rev_tag ON /*_*/change_tag (ct_rev_id,ct_tag);
+-- Covering index, so we can pull all the info only out of the index.
+CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
+
+
 -- 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,
-       ts_log_id int NULL,
-       ts_rev_id int NULL,
-       ts_tags BLOB NOT NULL,
-
-       UNIQUE KEY (ts_rc_id),
-       UNIQUE KEY (ts_log_id),
-       UNIQUE KEY (ts_rev_id),
+  ts_rc_id int NULL,
+  ts_log_id int NULL,
+  ts_rev_id int NULL,
+  ts_tags blob NOT NULL
 ) /*$wgDBTableOptions*/;
 
+CREATE UNIQUE INDEX /*i*/tag_summary_rc_id ON /*_*/tag_summary (ts_rc_id);
+CREATE UNIQUE INDEX /*i*/tag_summary_log_id ON /*_*/tag_summary (ts_log_id);
+CREATE UNIQUE INDEX /*i*/tag_summary_rev_id ON /*_*/tag_summary (ts_rev_id);
+
+
 CREATE TABLE /*_*/valid_tag (
-       vt_tag varchar(255) NOT NULL,
-       PRIMARY KEY (vt_tag)
+  vt_tag varchar(255) NOT NULL PRIMARY KEY
+) /*$wgDBTableOptions*/;
+
+CREATE TABLE /*_*/user_properties(
+  up_user int not null,
+  up_property varbinary(32) not null,
+  up_value blob
 ) /*$wgDBTableOptions*/;
 
+CREATE UNIQUE INDEX /*i*/user_properties_user_property on user_properties (up_user,up_property);
+CREATE INDEX /*i*/user_properties_property on user_properties (up_property);
 
 -- vim: sw=2 sts=2 et