--
-- 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;
-- 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;
-- 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;
--
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.
--
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*
--
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
CREATE TABLE /*$wgDBprefix*/linkscc (
lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
lcc_cacheobj MEDIUMBLOB NOT NULL
-);
+
+) TYPE=InnoDB;
-- 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
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;
exptime datetime,
unique key (keyname),
key (exptime)
-);
+
+) TYPE=InnoDB;
-- 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;
-- 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
-- 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;
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;
-- 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',
`val_value` int(11) default '0',
`val_comment` varchar(255) NOT NULL default '',
KEY `val_user` (`val_user`,`val_revision`)
-) TYPE=MyISAM;
+) TYPE=InnoDB;
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;
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
-- Special-purpose indexes
INDEX (page_random),
INDEX (page_len)
-);
+
+) TYPE=InnoDB;
--
-- Every edit of a page creates also a revision row.
INDEX page_timestamp (rev_page,rev_timestamp),
INDEX user_timestamp (rev_user,rev_timestamp),
INDEX usertext_timestamp (rev_user_text,rev_timestamp)
-);
+
+) TYPE=InnoDB;
--
old_flags tinyblob NOT NULL default '',
PRIMARY KEY old_id (old_id)
-);
+
+) TYPE=InnoDB;
--
-- Holding area for deleted articles, which may be viewed
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.
UNIQUE KEY l_from(l_from,l_to),
KEY (l_to)
-);
+
+) TYPE=InnoDB;
--
-- Track links to pages that don't yet exist.
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*
UNIQUE KEY il_from(il_from,il_to),
KEY (il_to)
-);
+
+) TYPE=InnoDB;
--
-- Track category inclusions *used inline*
-- Not really used?
KEY cl_timestamp(cl_to,cl_timestamp)
-);
+
+) TYPE=InnoDB;
--
-- Stores (possibly gzipped) serialized objects with
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
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;
PRIMARY KEY ipb_id (ipb_id),
INDEX ipb_address (ipb_address),
INDEX ipb_user (ipb_user)
-);
+
+) TYPE=InnoDB;
--
-- Used by Special:Newimages and Special:Imagelist
INDEX img_timestamp (img_timestamp)
-);
+
+) TYPE=InnoDB;
--
-- Previous revisions of uploaded files.
oi_timestamp char(14) binary NOT NULL default '',
INDEX oi_name (oi_name(10))
-);
+
+) TYPE=InnoDB;
--
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
UNIQUE KEY (wl_user, wl_namespace, wl_title),
KEY namespace_title (wl_namespace,wl_title)
-);
+
+) TYPE=InnoDB;
--
math_mathml text,
UNIQUE KEY math_inputhash (math_inputhash)
-);
+
+) TYPE=InnoDB;
--
-- When using the default MySQL search backend, page titles
iw_local BOOL NOT NULL,
UNIQUE KEY iw_prefix (iw_prefix)
-);
+
+) TYPE=InnoDB;
--
-- Used for caching expensive grouped queries
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
exptime datetime,
unique key (keyname),
key (exptime)
-);
+
+) TYPE=InnoDB;
-- For article validation
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 (
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;
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;
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,
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,
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 );