Use InnoDB by default for table creations if available.
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 2 May 2005 08:40:17 +0000 (08:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 2 May 2005 08:40:17 +0000 (08:40 +0000)
14 files changed:
maintenance/archives/patch-categorylinks.sql
maintenance/archives/patch-interwiki.sql
maintenance/archives/patch-linkscc.sql
maintenance/archives/patch-linktables.sql
maintenance/archives/patch-logging.sql
maintenance/archives/patch-math.sql
maintenance/archives/patch-objectcache.sql
maintenance/archives/patch-querycache.sql
maintenance/archives/patch-searchindex.sql
maintenance/archives/patch-user_rights.sql
maintenance/archives/patch-userlevels.sql
maintenance/archives/patch-validate.sql
maintenance/tables.sql
maintenance/updaters.inc

index 9856235..11542d5 100644 (file)
@@ -1,15 +1,34 @@
 --
 -- Track category inclusions *used inline*
--- cl_from keys to cur_id, cl_to keys to cur_title of the category page.
--- cl_sortkey is the title of the linking page or an optional override
--- cl_timestamp marks when the link was last added
+-- This tracks a single level of category membership
+-- (folksonomic tagging, really).
 --
 CREATE TABLE /*$wgDBprefix*/categorylinks (
+  -- Key to page_id of the page defined as a category member.
   cl_from int(8) unsigned NOT NULL default '0',
+  
+  -- Name of the category.
+  -- This is also the page_title of the category's description page;
+  -- all such pages are in namespace 14 (NS_CATEGORY).
   cl_to varchar(255) binary NOT NULL default '',
+  
+  -- The title of the linking page, or an optional override
+  -- to determine sort order. Sorting is by binary order, which
+  -- isn't always ideal, but collations seem to be an exciting
+  -- and dangerous new world in MySQL...
   cl_sortkey varchar(255) binary NOT NULL default '',
+  
+  -- This isn't really used at present. Provided for an optional
+  -- sorting method by approximate addition time.
   cl_timestamp timestamp NOT NULL,
+  
   UNIQUE KEY cl_from(cl_from,cl_to),
+  
+  -- This key is trouble. It's incomplete, AND it's too big
+  -- when collation is set to UTF-8. Bleeeacch!
   KEY cl_sortkey(cl_to,cl_sortkey(128)),
+  
+  -- Not really used?
   KEY cl_timestamp(cl_to,cl_timestamp)
-);
+
+) TYPE=InnoDB;
index e4f3b6f..90b162e 100644 (file)
@@ -3,9 +3,18 @@
 -- Import the default mappings from maintenance/interwiki.sql
 
 CREATE TABLE /*$wgDBprefix*/interwiki (
+  -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
   iw_prefix char(32) NOT NULL,
+  
+  -- The URL of the wiki, with "$1" as a placeholder for an article name.
+  -- Any spaces in the name will be transformed to underscores before
+  -- insertion.
   iw_url char(127) NOT NULL,
+  
+  -- A boolean value indicating whether the wiki is in this project
+  -- (used, for example, to detect redirect loops)
   iw_local BOOL NOT NULL,
+  
   UNIQUE KEY iw_prefix (iw_prefix)
-);
 
+) TYPE=InnoDB;
index 4be2bde..91d4da5 100644 (file)
@@ -2,9 +2,11 @@
 -- linkscc table used to cache link lists in easier to digest form
 -- November 2003
 --
+-- Format later updated.
+--
 
-CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/linkscc (
+CREATE TABLE /*$wgDBprefix*/linkscc (
   lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
-  lcc_title VARCHAR(255) binary NOT NULL UNIQUE KEY,
-  lcc_cacheobj MEDIUMBLOB NOT NULL);
+  lcc_cacheobj MEDIUMBLOB NOT NULL
 
+) TYPE=InnoDB;
index 45361e8..bb9bd03 100644 (file)
@@ -4,11 +4,19 @@
 --
 DROP TABLE IF EXISTS /*$wgDBprefix*/links;
 CREATE TABLE /*$wgDBprefix*/links (
+  -- Key to the page_id of the page containing the link.
   l_from int(8) unsigned NOT NULL default '0',
+  
+  -- Key to the page_id of the link target.
+  -- An unfortunate consequence of this is that rename
+  -- operations require changing the links entries for
+  -- all links to the moved page.
   l_to int(8) unsigned NOT NULL default '0',
+  
   UNIQUE KEY l_from(l_from,l_to),
   KEY (l_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track links to pages that don't yet exist.
@@ -17,11 +25,17 @@ CREATE TABLE /*$wgDBprefix*/links (
 --
 DROP TABLE IF EXISTS /*$wgDBprefix*/brokenlinks;
 CREATE TABLE /*$wgDBprefix*/brokenlinks (
+  -- Key to the page_id of the page containing the link.
   bl_from int(8) unsigned NOT NULL default '0',
+  
+  -- Text of the target page title ("namesapce:title").
+  -- Unfortunately this doesn't split the namespace index
+  -- key and therefore can't easily be joined to anything.
   bl_to varchar(255) binary NOT NULL default '',
   UNIQUE KEY bl_from(bl_from,bl_to),
   KEY (bl_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track links to images *used inline*
@@ -30,11 +44,18 @@ CREATE TABLE /*$wgDBprefix*/brokenlinks (
 --
 DROP TABLE IF EXISTS /*$wgDBprefix*/imagelinks;
 CREATE TABLE /*$wgDBprefix*/imagelinks (
+  -- Key to page_id of the page containing the image / media link.
   il_from int(8) unsigned NOT NULL default '0',
+  
+  -- Filename of target image.
+  -- This is also the page_title of the file's description page;
+  -- all such pages are in namespace 6 (NS_IMAGE).
   il_to varchar(255) binary NOT NULL default '',
+  
   UNIQUE KEY il_from(il_from,il_to),
   KEY (il_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Stores (possibly gzipped) serialized objects with
@@ -45,4 +66,5 @@ DROP TABLE IF EXISTS /*$wgDBprefix*/linkscc;
 CREATE TABLE /*$wgDBprefix*/linkscc (
   lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
   lcc_cacheobj MEDIUMBLOB NOT NULL
-);
+
+) TYPE=InnoDB;
index 44d6d9e..88c8bdf 100644 (file)
@@ -17,15 +17,20 @@ CREATE TABLE /*$wgDBprefix*/logging (
   -- Key to the page affected. Where a user is the target,
   -- this will point to the user page.
   log_namespace tinyint unsigned NOT NULL default 0,
-  log_title varchar(255) NOT NULL default '',
+  log_title varchar(255) binary NOT NULL default '',
   
   -- Freeform text. Interpreted as edit history comments.
   log_comment varchar(255) NOT NULL default '',
   
+  -- LF separated list of miscellaneous parameters
+  log_params blob NOT NULL default '',
+
   KEY type_time (log_type, log_timestamp),
   KEY user_time (log_user, log_timestamp),
   KEY page_time (log_namespace, log_title, log_timestamp)
-);
+
+) TYPE=InnoDB;
+
 
 -- Change from unsigned to signed so we can store special pages
 ALTER TABLE recentchanges
index 5deba0d..aee24a8 100644 (file)
@@ -7,10 +7,22 @@
 
 DROP TABLE IF EXISTS /*$wgDBprefix*/math;
 CREATE TABLE /*$wgDBprefix*/math (
-    math_inputhash varchar(16) NOT NULL,
-    math_outputhash varchar(16) NOT NULL,
-    math_html_conservativeness tinyint(1) NOT NULL,
-    math_html text,
-    math_mathml text,
-    UNIQUE KEY math_inputhash (math_inputhash)
-);
+  -- Binary MD5 hash of the latex fragment, used as an identifier key.
+  math_inputhash varchar(16) NOT NULL,
+  
+  -- Not sure what this is, exactly...
+  math_outputhash varchar(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(1) NOT NULL,
+  
+  -- HTML output from texvc, if any
+  math_html text,
+  
+  -- MathML output from texvc, if any
+  math_mathml text,
+  
+  UNIQUE KEY math_inputhash (math_inputhash)
+
+) TYPE=InnoDB;
index 86a2f1b..18572aa 100644 (file)
@@ -5,4 +5,5 @@ CREATE TABLE /*$wgDBprefix*/objectcache (
   exptime datetime,
   unique key (keyname),
   key (exptime)
-);
+
+) TYPE=InnoDB;
index 980af49..329b590 100644 (file)
@@ -1,9 +1,16 @@
 -- Used for caching expensive grouped queries
 
 CREATE TABLE /*$wgDBprefix*/querycache (
+  -- A key name, generally the base name of of the special page.
   qc_type char(32) NOT NULL,
+  
+  -- Some sort of stored value. Sizes, counts...
   qc_value int(5) unsigned NOT NULL default '0',
+  
+  -- Target namespace+title
   qc_namespace tinyint(2) unsigned NOT NULL default '0',
   qc_title char(255) binary NOT NULL default '',
+  
   KEY (qc_type,qc_value)
-);
+
+) TYPE=InnoDB;
index a9f4cdb..fb54dbb 100644 (file)
@@ -8,11 +8,18 @@
 -- Creating searchindex table...
 DROP TABLE IF EXISTS /*$wgDBprefix*/searchindex;
 CREATE TABLE /*$wgDBprefix*/searchindex (
+  -- Key to page_id
   si_page int(8) unsigned NOT NULL,
+  
+  -- Munged version of title
   si_title varchar(255) NOT NULL default '',
+  
+  -- Munged version of body text
   si_text mediumtext NOT NULL default '',
+  
   UNIQUE KEY (si_page)
-) TYPE=MyISAM PACK_KEYS=1;
+
+) TYPE=MyISAM;
 
 -- Copying data into new table...
 INSERT INTO /*$wgDBprefix*/searchindex
index 1eefb3d..36f0102 100644 (file)
@@ -6,10 +6,15 @@
 -- database but keep user rights local to the wiki.
 
 CREATE TABLE /*$wgDBprefix*/user_rights (
-       ur_user int(5) unsigned NOT NULL,
-       ur_rights tinyblob NOT NULL default '',
-       UNIQUE KEY ur_user (ur_user)
-) PACK_KEYS=1;
+  -- Key to user_id
+  ur_user int(5) unsigned NOT NULL,
+  
+  -- Comma-separated list of permission keys
+  ur_rights tinyblob NOT NULL default '',
+  
+  UNIQUE KEY ur_user (ur_user)
+
+) TYPE=InnoDB;
 
 INSERT INTO /*$wgDBprefix*/user_rights SELECT user_id,user_rights FROM /*$wgDBprefix*/user;
 
index 18502c9..96db38e 100644 (file)
@@ -10,11 +10,13 @@ CREATE TABLE /*$wgDBprefix*/`group` (
   group_description varchar(255) NOT NULL default '',
   group_rights tinyblob,
   PRIMARY KEY  (group_id)
-);
+
+) TYPE=InnoDB;
 
 -- Relation table between user and groups
 CREATE TABLE /*$wgDBprefix*/user_groups (
        ug_user int(5) unsigned NOT NULL default '0',
        ug_group int(5) unsigned NOT NULL default '0',
        PRIMARY KEY  (ug_user,ug_group)
-);
+
+) TYPE=InnoDB;
index f3f6341..2a48b58 100644 (file)
@@ -1,7 +1,7 @@
 -- For article validation
 
-DROP TABLE IF EXISTS `validate`;
-CREATE TABLE `validate` (
+DROP TABLE IF EXISTS /*$wgDBprefix*/validate;
+CREATE TABLE /*$wgDBprefix*/validate (
   `val_user` int(11) NOT NULL default '0',
   `val_page` int(11) unsigned NOT NULL default '0',
   `val_revision` int(11) unsigned NOT NULL default '0',
@@ -9,4 +9,4 @@ CREATE TABLE `validate` (
   `val_value` int(11) default '0',
   `val_comment` varchar(255) NOT NULL default '',
   KEY `val_user` (`val_user`,`val_revision`)
-) TYPE=MyISAM;
+) TYPE=InnoDB;
index a8d5d53..5a61235 100644 (file)
@@ -106,7 +106,8 @@ CREATE TABLE /*$wgDBprefix*/user (
   PRIMARY KEY user_id (user_id),
   INDEX user_name (user_name(10)),
   INDEX (user_email_token)
-);
+
+) TYPE=InnoDB;
 
 --
 -- User permissions have been broken out to a separate table;
@@ -123,7 +124,8 @@ CREATE TABLE /*$wgDBprefix*/user_rights (
   ur_rights tinyblob NOT NULL default '',
   
   UNIQUE KEY ur_user (ur_user)
-);
+
+) TYPE=InnoDB;
 
 -- The following table is no longer needed with Enotif >= 2.00
 -- Entries for newtalk on user_talk page are handled like in the watchlist table
@@ -192,7 +194,8 @@ CREATE TABLE /*$wgDBprefix*/page (
   -- Special-purpose indexes
   INDEX (page_random),
   INDEX (page_len)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Every edit of a page creates also a revision row.
@@ -239,7 +242,8 @@ CREATE TABLE /*$wgDBprefix*/revision (
   INDEX page_timestamp (rev_page,rev_timestamp),
   INDEX user_timestamp (rev_user,rev_timestamp),
   INDEX usertext_timestamp (rev_user_text,rev_timestamp)
-);
+
+) TYPE=InnoDB;
 
 
 --
@@ -272,7 +276,8 @@ CREATE TABLE /*$wgDBprefix*/text (
   old_flags tinyblob NOT NULL default '',
   
   PRIMARY KEY old_id (old_id)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Holding area for deleted articles, which may be viewed
@@ -322,7 +327,8 @@ CREATE TABLE /*$wgDBprefix*/archive (
   ar_text_id int(8) unsigned,
   
   KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track links within the wiki that do exist.
@@ -342,7 +348,8 @@ CREATE TABLE /*$wgDBprefix*/links (
   
   UNIQUE KEY l_from(l_from,l_to),
   KEY (l_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track links to pages that don't yet exist.
@@ -359,7 +366,8 @@ CREATE TABLE /*$wgDBprefix*/brokenlinks (
   bl_to varchar(255) binary NOT NULL default '',
   UNIQUE KEY bl_from(bl_from,bl_to),
   KEY (bl_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track links to images *used inline*
@@ -377,7 +385,8 @@ CREATE TABLE /*$wgDBprefix*/imagelinks (
   
   UNIQUE KEY il_from(il_from,il_to),
   KEY (il_to)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Track category inclusions *used inline*
@@ -411,7 +420,8 @@ CREATE TABLE /*$wgDBprefix*/categorylinks (
   
   -- Not really used?
   KEY cl_timestamp(cl_to,cl_timestamp)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Stores (possibly gzipped) serialized objects with
@@ -421,7 +431,8 @@ CREATE TABLE /*$wgDBprefix*/categorylinks (
 CREATE TABLE /*$wgDBprefix*/linkscc (
   lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
   lcc_cacheobj MEDIUMBLOB NOT NULL
-);
+
+) TYPE=InnoDB;
 
 --
 -- Contains a single row with some aggregate info
@@ -444,7 +455,8 @@ CREATE TABLE /*$wgDBprefix*/site_stats (
   ss_good_articles bigint(20) unsigned default '0',
   
   UNIQUE KEY ss_row_id (ss_row_id)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Stores an ID for every time any article is visited;
@@ -493,7 +505,8 @@ CREATE TABLE /*$wgDBprefix*/ipblocks (
   PRIMARY KEY ipb_id (ipb_id),
   INDEX ipb_address (ipb_address),
   INDEX ipb_user (ipb_user)
-);
+
+) TYPE=InnoDB;
 
 
 --
@@ -540,7 +553,8 @@ CREATE TABLE /*$wgDBprefix*/image (
   
   -- Used by Special:Newimages and Special:Imagelist
   INDEX img_timestamp (img_timestamp)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Previous revisions of uploaded files.
@@ -567,7 +581,8 @@ CREATE TABLE /*$wgDBprefix*/oldimage (
   oi_timestamp char(14) binary NOT NULL default '',
 
   INDEX oi_name (oi_name(10))
-);
+
+) TYPE=InnoDB;
 
 
 --
@@ -631,7 +646,8 @@ CREATE TABLE /*$wgDBprefix*/recentchanges (
   INDEX rc_cur_id (rc_cur_id),
   INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp),
   INDEX rc_ip (rc_ip)
-);
+
+) TYPE=InnoDB;
 
 CREATE TABLE /*$wgDBprefix*/watchlist (
   -- Key to user_id
@@ -650,7 +666,8 @@ CREATE TABLE /*$wgDBprefix*/watchlist (
   
   UNIQUE KEY (wl_user, wl_namespace, wl_title),
   KEY namespace_title (wl_namespace,wl_title)
-);
+
+) TYPE=InnoDB;
 
 
 --
@@ -675,7 +692,8 @@ CREATE TABLE /*$wgDBprefix*/math (
   math_mathml text,
   
   UNIQUE KEY math_inputhash (math_inputhash)
-);
+
+) TYPE=InnoDB;
 
 --
 -- When using the default MySQL search backend, page titles
@@ -718,7 +736,8 @@ CREATE TABLE /*$wgDBprefix*/interwiki (
   iw_local BOOL NOT NULL,
   
   UNIQUE KEY iw_prefix (iw_prefix)
-);
+
+) TYPE=InnoDB;
 
 --
 -- Used for caching expensive grouped queries
@@ -735,7 +754,8 @@ CREATE TABLE /*$wgDBprefix*/querycache (
   qc_title char(255) binary NOT NULL default '',
   
   KEY (qc_type,qc_value)
-);
+
+) TYPE=InnoDB;
 
 --
 -- For a few generic cache operations if not using Memcached
@@ -746,7 +766,8 @@ CREATE TABLE /*$wgDBprefix*/objectcache (
   exptime datetime,
   unique key (keyname),
   key (exptime)
-);
+
+) TYPE=InnoDB;
 
 -- For article validation
 CREATE TABLE /*$wgDBprefix*/validate (
@@ -757,7 +778,7 @@ CREATE TABLE /*$wgDBprefix*/validate (
   `val_value` int(11) default '0',
   `val_comment` varchar(255) NOT NULL default '',
   KEY `val_user` (`val_user`,`val_revision`)
-) TYPE=MyISAM;
+) TYPE=InnoDB;
 
 
 CREATE TABLE /*$wgDBprefix*/logging (
@@ -787,7 +808,8 @@ CREATE TABLE /*$wgDBprefix*/logging (
   KEY type_time (log_type, log_timestamp),
   KEY user_time (log_user, log_timestamp),
   KEY page_time (log_namespace, log_title, log_timestamp)
-);
+
+) TYPE=InnoDB;
 
 
 
@@ -800,11 +822,13 @@ CREATE TABLE /*$wgDBprefix*/`group` (
   group_description varchar(255) NOT NULL default '',
   group_rights tinyblob,
   PRIMARY KEY  (group_id)
-);
+
+) TYPE=InnoDB;
 
 -- Relation table between user and groups
 CREATE TABLE /*$wgDBprefix*/user_groups (
        ug_user int(5) unsigned NOT NULL default '0',
        ug_group int(5) unsigned NOT NULL default '0',
        PRIMARY KEY  (ug_user,ug_group)
-);
+
+) TYPE=InnoDB;
index 48b70d1..1120638 100644 (file)
@@ -342,7 +342,7 @@ function do_schema_restructuring() {
                
 
                echo "......Creating tables.\n";
-               $wgDatabase->query(" CREATE TABLE $page (
+               $wgDatabase->query("CREATE TABLE $page (
                        page_id int(8) unsigned NOT NULL auto_increment,
                        page_namespace tinyint NOT NULL,
                        page_title varchar(255) binary NOT NULL,
@@ -359,7 +359,7 @@ function do_schema_restructuring() {
                        UNIQUE INDEX name_title (page_namespace,page_title),
                        INDEX (page_random),
                        INDEX (page_len)
-                       )", $fname );
+                       ) TYPE=InnoDB", $fname );
                $wgDatabase->query("CREATE TABLE $revision (
                        rev_id int(8) unsigned NOT NULL auto_increment,
                        rev_page int(8) unsigned NOT NULL,
@@ -376,7 +376,7 @@ function do_schema_restructuring() {
                        INDEX page_timestamp (rev_page,rev_timestamp),
                        INDEX user_timestamp (rev_user,rev_timestamp),
                        INDEX usertext_timestamp (rev_user_text,rev_timestamp)
-                       )", $fname );
+                       ) TYPE=InnoDB", $fname );
 
                echo "......Locking tables.\n";
                $wgDatabase->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", $fname );