user_newpassword tinyblob NOT NULL default '',
-- Note: email should be restricted, not public info.
- -- Same with passwords. ;)
+ -- Same with passwords.
user_email tinytext NOT NULL default '',
-- Newline-separated list of name=value pairs.
user_email_token_expires CHAR(14) BINARY,
PRIMARY KEY user_id (user_id),
- INDEX user_name (user_name(10)),
+ UNIQUE INDEX user_name (user_name),
INDEX (user_email_token)
-);
+
+) TYPE=InnoDB;
--
-- User permissions have been broken out to a separate table;
-- this allows sites with a shared user table to have different
-- permissions assigned to a user in each project.
--
--- TODO: de-blob this; it should be a property table
+-- This table replaces the old user_rights field which used a
+-- comma-separated blob.
--
-CREATE TABLE /*$wgDBprefix*/user_rights (
+CREATE TABLE /*$wgDBprefix*/user_groups (
-- Key to user_id
- ur_user int(5) unsigned NOT NULL,
+ ug_user int(5) unsigned NOT NULL default '0',
- -- Comma-separated list of permission keys
- ur_rights tinyblob NOT NULL default '',
+ -- Group names are short symbolic string keys.
+ -- The set of group names is open-ended, though in practice
+ -- only some predefined ones are likely to be used.
+ --
+ -- At runtime $wgGroupPermissions will associate group keys
+ -- 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 char(16) NOT NULL default '',
- UNIQUE KEY ur_user (ur_user)
-);
+ PRIMARY KEY (ug_user,ug_group),
+ KEY (ug_group)
+) 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
-- A page name is broken into a namespace and a title.
-- The namespace keys are UI-language-independent constants,
-- defined in Namespace.php.
- page_namespace tinyint NOT NULL,
+ page_namespace int NOT NULL,
-- The rest of the title, as text.
-- Spaces are transformed into underscores in title storage.
-- This timestamp is updated whenever the page changes in
-- a way requiring it to be re-rendered, invalidating caches.
- -- On top of editing this includes permission changes,
+ -- Aside from editing this includes permission changes,
-- creation or deletion of linked pages, and alteration
-- of contained templates.
page_touched char(14) binary NOT NULL default '',
-
-- Handy key to revision.rev_id of the current revision.
-- This may be 0 during page creation, but that shouldn't
-- 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;
--
-- Depending on the contents of the old_flags field, the text
-- may be convenient plain text, or it may be funkily encoded.
- old_text mediumtext NOT NULL default '',
+ old_text mediumblob NOT NULL default '',
-- Comma-separated list of flags:
-- gzip: text is compressed with PHP's gzdeflate() function.
old_flags tinyblob NOT NULL default '',
PRIMARY KEY old_id (old_id)
-);
+
+) TYPE=InnoDB;
--
-- Holding area for deleted articles, which may be viewed
-- fields, with several caveats.
--
CREATE TABLE /*$wgDBprefix*/archive (
- ar_namespace tinyint(2) unsigned NOT NULL default '0',
+ ar_namespace int NOT NULL default '0',
ar_title varchar(255) binary NOT NULL default '',
-- Newly deleted pages will not store text in this table,
-- This field is retained for backwards compatibility,
-- so old archived pages will remain accessible after
-- upgrading from 1.4 to 1.5.
- ar_text mediumtext NOT NULL default '',
+ -- Text may be gzipped or otherwise funky.
+ ar_text mediumblob NOT NULL default '',
-- Basic revision stuff...
ar_comment tinyblob NOT NULL default '',
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.
--- These rows must be removed when the target page is
--- deleted, and replaced with brokenlinks entries.
--- They must also be updated if a target page is renamed.
+-- Track page-to-page hyperlinks within the wiki.
--
-CREATE TABLE /*$wgDBprefix*/links (
+CREATE TABLE /*$wgDBprefix*/pagelinks (
-- Key to the page_id of the page containing the link.
- l_from int(8) unsigned NOT NULL default '0',
+ pl_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',
+ -- Key to page_namespace/page_title of the target page.
+ -- The target page may or may not exist, and due to renames
+ -- and deletions may refer to different page records as time
+ -- goes by.
+ pl_namespace int NOT NULL default '0',
+ pl_title varchar(255) binary NOT NULL default '',
- UNIQUE KEY l_from(l_from,l_to),
- KEY (l_to)
-);
+ UNIQUE KEY pl_from(pl_from,pl_namespace,pl_title),
+ KEY (pl_namespace,pl_title)
+
+) TYPE=InnoDB;
---
--- Track links to pages that don't yet exist.
--- These rows must be removed when the target page
--- is created, and replaced with links table entries.
---
-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)
-);
--
-- Track links to images *used inline*
UNIQUE KEY il_from(il_from,il_to),
KEY (il_to)
-);
+
+) TYPE=InnoDB;
--
-- Track category inclusions *used inline*
-- 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 '',
+ --
+ -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
+ -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
+ -- To sort properly on the shorter key, this field needs to be
+ -- the same shortness.
+ cl_sortkey varchar(86) binary NOT NULL default '',
-- This isn't really used at present. Provided for an optional
-- sorting method by approximate addition time.
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)),
+ -- We always sort within a given category...
+ KEY cl_sortkey(cl_to,cl_sortkey),
-- Not really used?
KEY cl_timestamp(cl_to,cl_timestamp)
-);
---
--- Stores (possibly gzipped) serialized objects with
--- cache arrays to reduce database load slurping up
--- from links and brokenlinks.
---
-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
-- * in namespace 0
-- * not a redirect
-- * contains the text '[['
+ -- See isCountable() in includes/Article.php
ss_good_articles bigint(20) unsigned default '0',
+ -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
+ ss_total_pages bigint(20) default -1,
+
+ -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
+ ss_users bigint(20) default -1,
+
+ -- Deprecated, no longer updated as of 1.5
+ ss_admins int(10) default -1,
+
UNIQUE KEY ss_row_id (ss_row_id)
-);
+
+) TYPE=InnoDB;
--
-- Stores an ID for every time any article is visited;
-- depending on $wgHitcounterUpdateFreq, it is
--- periodically cleared and the cur_counter column
--- in the cur table updated for the all articles
+-- periodically cleared and the page_counter column
+-- in the page table updated for the all articles
-- that have been visited.)
--
CREATE TABLE /*$wgDBprefix*/hitcounter (
PRIMARY KEY ipb_id (ipb_id),
INDEX ipb_address (ipb_address),
INDEX ipb_user (ipb_user)
-);
+
+) TYPE=InnoDB;
--
-- For images, bits per pixel if known.
img_bits int(3) NOT NULL default '0',
- -- File type key returned by getimagesize().
- -- See http://www.php.net/getimagesize for possible values.
- img_type int(3) NOT NULL default '0',
+ -- Media type as defined by the MEDIATYPE_xxx constants
+ img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
+
+ -- major part of a MIME media type as defined by IANA
+ -- see http://www.iana.org/assignments/media-types/
+ img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
+
+ -- minor part of a MIME media type as defined by IANA
+ -- the minor parts are not required to adher to any standard
+ -- but should be consistent throughout the database
+ -- see http://www.iana.org/assignments/media-types/
+ img_minor_mime varchar(32) NOT NULL default "unknown",
-- Description field as entered by the uploader.
-- This is displayed in image upload history and logs.
-- Used by Special:Newimages and Special:Imagelist
INDEX img_timestamp (img_timestamp)
-);
+
+) TYPE=InnoDB;
--
-- Previous revisions of uploaded files.
oi_width int(5) NOT NULL default 0,
oi_height int(5) NOT NULL default 0,
oi_bits int(3) NOT NULL default 0,
- oi_type int(3) NOT NULL default 0,
oi_description tinyblob NOT NULL default '',
oi_user int(5) unsigned NOT NULL default '0',
oi_user_text varchar(255) binary NOT NULL default '',
oi_timestamp char(14) binary NOT NULL default '',
INDEX oi_name (oi_name(10))
-);
+
+) TYPE=InnoDB;
--
rc_user_text varchar(255) binary NOT NULL default '',
-- When pages are renamed, their RC entries do _not_ change.
- rc_namespace tinyint(3) NOT NULL default '0',
+ rc_namespace int NOT NULL default '0',
rc_title varchar(255) binary NOT NULL default '',
-- as in revision...
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
-- Key to page_namespace/page_title
-- Note that users may watch patches which do not exist yet,
-- or existed in the past but have been deleted.
- wl_namespace tinyint(2) unsigned NOT NULL default '0',
+ wl_namespace int NOT NULL default '0',
wl_title varchar(255) binary NOT NULL default '',
-- Timestamp when user was last sent a notification e-mail;
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_value int(5) unsigned NOT NULL default '0',
-- Target namespace+title
- qc_namespace tinyint(2) unsigned NOT NULL default '0',
+ qc_namespace int NOT NULL default '0',
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)
-);
--- For storing revision text
--- This isn't used...
-CREATE TABLE /*$wgDBprefix*/blobs (
- blob_index char(255) binary NOT NULL default '',
- blob_data longblob NOT NULL default '',
- UNIQUE key blob_index (blob_index)
-);
+) TYPE=InnoDB;
-- For article validation
CREATE TABLE /*$wgDBprefix*/validate (
`val_type` int(11) unsigned NOT NULL default '0',
`val_value` int(11) default '0',
`val_comment` varchar(255) NOT NULL default '',
+ `val_ip` varchar(20) NOT NULL default '',
KEY `val_user` (`val_user`,`val_revision`)
-) TYPE=MyISAM;
+) TYPE=InnoDB;
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_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-- Freeform text. Interpreted as edit history comments.
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;
-- Hold group name and description
-CREATE TABLE /*$wgDBprefix*/`group` (
- group_id int(5) unsigned NOT NULL auto_increment,
- group_name varchar(50) NOT NULL default '',
- group_description varchar(255) NOT NULL default '',
- group_rights tinyblob,
- PRIMARY KEY (group_id)
-);
-
--- 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)
-);
+--CREATE TABLE /*$wgDBprefix*/groups (
+-- gr_id int(5) unsigned NOT NULL auto_increment,
+-- gr_name varchar(50) NOT NULL default '',
+-- gr_description varchar(255) NOT NULL default '',
+-- gr_rights tinyblob,
+-- PRIMARY KEY (gr_id)
+--
+--) TYPE=InnoDB;