1 -- SQL to create the initial tables for the MediaWiki database.
2 -- This is read and executed by the install script; you should
3 -- not have to run it by itself unless doing a manual install.
8 -- If possible, create tables as InnoDB to benefit from the
9 -- superior resiliency against crashes and ability to read
10 -- during writes (and write during reads!)
12 -- Only the 'searchindex' table requires MyISAM due to the
13 -- requirement for fulltext index support, which is missing
17 -- The MySQL table backend for MediaWiki currently uses
18 -- 14-character CHAR or VARCHAR fields to store timestamps.
19 -- The format is YYYYMMDDHHMMSS, which is derived from the
20 -- text format of MySQL's TIMESTAMP fields.
22 -- Historically TIMESTAMP fields were used, but abandoned
23 -- in early 2002 after a lot of trouble with the fields
26 -- The PostgreSQL backend uses DATETIME fields for timestamps,
27 -- and we will migrate the MySQL definitions at some point as
31 -- The /*$wgDBprefix*/ comments in this and other files are
32 -- replaced with the defined table prefix by the installer
33 -- and updater scripts. If you are installing or running
34 -- updates manually, you will need to manually insert the
35 -- table prefix if any when running these scripts.
40 -- The user table contains basic account information,
41 -- authentication keys, etc.
43 -- Some multi-wiki sites may share a single central user table
44 -- between separate wikis using the $wgSharedDB setting.
46 -- Note that when a external authentication plugin is used,
47 -- user table entries still need to be created to store
48 -- preferences and to key tracking information in the other
51 CREATE TABLE /*$wgDBprefix*/user (
52 user_id int(5) unsigned NOT NULL auto_increment,
54 -- Usernames must be unique, must not be in the form of
55 -- an IP address. _Shouldn't_ allow slashes or case
56 -- conflicts. Spaces are allowed, and are _not_ converted
57 -- to underscores like titles. (Conflicts?)
58 user_name varchar(255) binary NOT NULL default '',
60 -- Optional 'real name' to be displayed in credit listings
61 user_real_name varchar(255) binary NOT NULL default '',
63 -- Password hashes, normally hashed like so:
64 -- MD5(CONCAT(user_id,'-',MD5(plaintext_password)))
65 user_password tinyblob NOT NULL default '',
67 -- When using 'mail me a new password', a random
68 -- password is generated and the hash stored here.
69 -- The previous password is left in place until
70 -- someone actually logs in with the new password,
71 -- at which point the hash is moved to user_password
72 -- and the old password is invalidated.
73 user_newpassword tinyblob NOT NULL default '',
75 -- Note: email should be restricted, not public info.
76 -- Same with passwords.
77 user_email tinytext NOT NULL default '',
79 -- Newline-separated list of name=value pairs.
80 user_options blob NOT NULL default '',
82 -- This is a timestamp which is updated when a user
83 -- logs in, logs out, changes preferences, or performs
84 -- some other action requiring HTML cache invalidation
85 -- to ensure that the UI is updated.
86 user_touched char(14) binary NOT NULL default '',
88 -- A pseudorandomly generated value that is stored in
89 -- a cookie when the "remember password" feature is
90 -- used (previously, a hash of the password was used, but
91 -- this was vulnerable to cookie-stealing attacks)
92 user_token char(32) binary NOT NULL default '',
94 -- Initially NULL; when a user's e-mail address has been
95 -- validated by returning with a mailed token, this is
96 -- set to the current timestamp.
97 user_email_authenticated CHAR(14) BINARY,
99 -- Randomly generated token created when the e-mail address
100 -- is set and a confirmation test mail sent.
101 user_email_token CHAR(32) BINARY,
103 -- Expiration date for the
104 user_email_token_expires CHAR(14) BINARY,
106 PRIMARY KEY user_id (user_id),
107 UNIQUE INDEX user_name (user_name),
108 INDEX (user_email_token)
113 -- User permissions have been broken out to a separate table;
114 -- this allows sites with a shared user table to have different
115 -- permissions assigned to a user in each project.
117 -- This table replaces the old user_rights field which used a
118 -- comma-separated blob.
120 CREATE TABLE /*$wgDBprefix*/user_groups (
122 ug_user int(5) unsigned NOT NULL default '0',
124 -- Group names are short symbolic string keys.
125 -- The set of group names is open-ended, though in practice
126 -- only some predefined ones are likely to be used.
128 -- At runtime $wgGroupPermissions will associate group keys
129 -- with particular permissions. A user will have the combined
130 -- permissions of any group they're explicitly in, plus
131 -- the implicit '*' and 'user' groups.
132 ug_group char(16) NOT NULL default '',
134 PRIMARY KEY (ug_user,ug_group),
138 -- Stores notifications of user talk page changes, for the display
139 -- of the "you have new messages" box
140 CREATE TABLE /*$wgDBprefix*/user_newtalk (
141 user_id int(5) NOT NULL default '0',
142 user_ip varchar(40) NOT NULL default '',
143 INDEX user_id (user_id),
144 INDEX user_ip (user_ip)
149 -- Core of the wiki: each page has an entry here which identifies
150 -- it by title and contains some essential metadata.
152 CREATE TABLE /*$wgDBprefix*/page (
153 -- Unique identifier number. The page_id will be preserved across
154 -- edits and rename operations, but not deletions and recreations.
155 page_id int(8) unsigned NOT NULL auto_increment,
157 -- A page name is broken into a namespace and a title.
158 -- The namespace keys are UI-language-independent constants,
159 -- defined in Namespace.php.
160 page_namespace int NOT NULL,
162 -- The rest of the title, as text.
163 -- Spaces are transformed into underscores in title storage.
164 page_title varchar(255) binary NOT NULL,
166 -- Comma-separated set of permission keys indicating who
167 -- can move or edit the page.
168 page_restrictions tinyblob NOT NULL default '',
170 -- Number of times this page has been viewed.
171 page_counter bigint(20) unsigned NOT NULL default '0',
173 -- 1 indicates the article is a redirect.
174 page_is_redirect tinyint(1) unsigned NOT NULL default '0',
176 -- 1 indicates this is a new entry, with only one edit.
177 -- Not all pages with one edit are new pages.
178 page_is_new tinyint(1) unsigned NOT NULL default '0',
180 -- Random value between 0 and 1, used for Special:Randompage
181 page_random real unsigned NOT NULL,
183 -- This timestamp is updated whenever the page changes in
184 -- a way requiring it to be re-rendered, invalidating caches.
185 -- Aside from editing this includes permission changes,
186 -- creation or deletion of linked pages, and alteration
187 -- of contained templates.
188 page_touched char(14) binary NOT NULL default '',
190 -- Handy key to revision.rev_id of the current revision.
191 -- This may be 0 during page creation, but that shouldn't
192 -- happen outside of a transaction... hopefully.
193 page_latest int(8) unsigned NOT NULL,
195 -- Uncompressed length in bytes of the page's current source text.
196 page_len int(8) unsigned NOT NULL,
198 PRIMARY KEY page_id (page_id),
199 UNIQUE INDEX name_title (page_namespace,page_title),
201 -- Special-purpose indexes
208 -- Every edit of a page creates also a revision row.
209 -- This stores metadata about the revision, and a reference
210 -- to the text storage backend.
212 CREATE TABLE /*$wgDBprefix*/revision (
213 rev_id int(8) unsigned NOT NULL auto_increment,
215 -- Key to page_id. This should _never_ be invalid.
216 rev_page int(8) unsigned NOT NULL,
218 -- Key to text.old_id, where the actual bulk text is stored.
219 -- It's possible for multiple revisions to use the same text,
220 -- for instance revisions where only metadata is altered
221 -- or a rollback to a previous version.
222 rev_text_id int(8) unsigned NOT NULL,
224 -- Text comment summarizing the change.
225 -- This text is shown in the history and other changes lists,
226 -- rendered in a subset of wiki markup.
227 rev_comment tinyblob NOT NULL default '',
229 -- Key to user_id of the user who made this edit.
230 -- Stores 0 for anonymous edits and for some mass imports.
231 rev_user int(5) unsigned NOT NULL default '0',
233 -- Text username or IP address of the editor.
234 rev_user_text varchar(255) binary NOT NULL default '',
237 rev_timestamp char(14) binary NOT NULL default '',
239 -- Records whether the user marked the 'minor edit' checkbox.
240 -- Many automated edits are marked as minor.
241 rev_minor_edit tinyint(1) unsigned NOT NULL default '0',
243 -- Not yet used; reserved for future changes to the deletion system.
244 rev_deleted tinyint(1) unsigned NOT NULL default '0',
246 PRIMARY KEY rev_page_id (rev_page, rev_id),
247 UNIQUE INDEX rev_id (rev_id),
248 INDEX rev_timestamp (rev_timestamp),
249 INDEX page_timestamp (rev_page,rev_timestamp),
250 INDEX user_timestamp (rev_user,rev_timestamp),
251 INDEX usertext_timestamp (rev_user_text,rev_timestamp)
257 -- Holds text of individual page revisions.
259 -- Field names are a holdover from the 'old' revisions table in
260 -- MediaWiki 1.4 and earlier: an upgrade will transform that
261 -- table into the 'text' table to minimize unnecessary churning
262 -- and downtime. If upgrading, the other fields will be left unused.
264 CREATE TABLE /*$wgDBprefix*/text (
265 -- Unique text storage key number.
266 -- Note that the 'oldid' parameter used in URLs does *not*
267 -- refer to this number anymore, but to rev_id.
268 old_id int(8) unsigned NOT NULL auto_increment,
270 -- Depending on the contents of the old_flags field, the text
271 -- may be convenient plain text, or it may be funkily encoded.
272 old_text mediumblob NOT NULL default '',
274 -- Comma-separated list of flags:
275 -- gzip: text is compressed with PHP's gzdeflate() function.
276 -- utf8: text was stored as UTF-8.
277 -- If $wgLegacyEncoding option is on, rows *without* this flag
278 -- will be converted to UTF-8 transparently at load time.
279 -- object: text field contained a serialized PHP object.
280 -- The object either contains multiple versions compressed
281 -- together to achieve a better compression ratio, or it refers
282 -- to another row where the text can be found.
283 old_flags tinyblob NOT NULL default '',
285 PRIMARY KEY old_id (old_id)
290 -- Holding area for deleted articles, which may be viewed
291 -- or restored by admins through the Special:Undelete interface.
292 -- The fields generally correspond to the page, revision, and text
293 -- fields, with several caveats.
295 CREATE TABLE /*$wgDBprefix*/archive (
296 ar_namespace int NOT NULL default '0',
297 ar_title varchar(255) binary NOT NULL default '',
299 -- Newly deleted pages will not store text in this table,
300 -- but will reference the separately existing text rows.
301 -- This field is retained for backwards compatibility,
302 -- so old archived pages will remain accessible after
303 -- upgrading from 1.4 to 1.5.
304 -- Text may be gzipped or otherwise funky.
305 ar_text mediumblob NOT NULL default '',
307 -- Basic revision stuff...
308 ar_comment tinyblob NOT NULL default '',
309 ar_user int(5) unsigned NOT NULL default '0',
310 ar_user_text varchar(255) binary NOT NULL,
311 ar_timestamp char(14) binary NOT NULL default '',
312 ar_minor_edit tinyint(1) NOT NULL default '0',
315 ar_flags tinyblob NOT NULL default '',
317 -- When revisions are deleted, their unique rev_id is stored
318 -- here so it can be retained after undeletion. This is necessary
319 -- to retain permalinks to given revisions after accidental delete
320 -- cycles or messy operations like history merges.
322 -- Old entries from 1.4 will be NULL here, and a new rev_id will
323 -- be created on undeletion for those revisions.
324 ar_rev_id int(8) unsigned,
326 -- For newly deleted revisions, this is the text.old_id key to the
327 -- actual stored text. To avoid breaking the block-compression scheme
328 -- and otherwise making storage changes harder, the actual text is
329 -- *not* deleted from the text table, merely hidden by removal of the
330 -- page and revision entries.
332 -- Old entries deleted under 1.2-1.4 will have NULL here, and their
333 -- ar_text and ar_flags fields will be used to create a new text
334 -- row upon undeletion.
335 ar_text_id int(8) unsigned,
337 KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
343 -- Track page-to-page hyperlinks within the wiki.
345 CREATE TABLE /*$wgDBprefix*/pagelinks (
346 -- Key to the page_id of the page containing the link.
347 pl_from int(8) unsigned NOT NULL default '0',
349 -- Key to page_namespace/page_title of the target page.
350 -- The target page may or may not exist, and due to renames
351 -- and deletions may refer to different page records as time
353 pl_namespace int NOT NULL default '0',
354 pl_title varchar(255) binary NOT NULL default '',
356 UNIQUE KEY pl_from(pl_from,pl_namespace,pl_title),
357 KEY (pl_namespace,pl_title)
363 -- Track links to images *used inline*
364 -- We don't distinguish live from broken links here, so
365 -- they do not need to be changed on upload/removal.
367 CREATE TABLE /*$wgDBprefix*/imagelinks (
368 -- Key to page_id of the page containing the image / media link.
369 il_from int(8) unsigned NOT NULL default '0',
371 -- Filename of target image.
372 -- This is also the page_title of the file's description page;
373 -- all such pages are in namespace 6 (NS_IMAGE).
374 il_to varchar(255) binary NOT NULL default '',
376 UNIQUE KEY il_from(il_from,il_to),
382 -- Track category inclusions *used inline*
383 -- This tracks a single level of category membership
384 -- (folksonomic tagging, really).
386 CREATE TABLE /*$wgDBprefix*/categorylinks (
387 -- Key to page_id of the page defined as a category member.
388 cl_from int(8) unsigned NOT NULL default '0',
390 -- Name of the category.
391 -- This is also the page_title of the category's description page;
392 -- all such pages are in namespace 14 (NS_CATEGORY).
393 cl_to varchar(255) binary NOT NULL default '',
395 -- The title of the linking page, or an optional override
396 -- to determine sort order. Sorting is by binary order, which
397 -- isn't always ideal, but collations seem to be an exciting
398 -- and dangerous new world in MySQL...
400 -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
401 -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
402 -- To sort properly on the shorter key, this field needs to be
403 -- the same shortness.
404 cl_sortkey varchar(86) binary NOT NULL default '',
406 -- This isn't really used at present. Provided for an optional
407 -- sorting method by approximate addition time.
408 cl_timestamp timestamp NOT NULL,
410 UNIQUE KEY cl_from(cl_from,cl_to),
412 -- We always sort within a given category...
413 KEY cl_sortkey(cl_to,cl_sortkey),
416 KEY cl_timestamp(cl_to,cl_timestamp)
421 -- Contains a single row with some aggregate info
422 -- on the state of the site.
424 CREATE TABLE /*$wgDBprefix*/site_stats (
425 -- The single row should contain 1 here.
426 ss_row_id int(8) unsigned NOT NULL,
428 -- Total number of page views, if hit counters are enabled.
429 ss_total_views bigint(20) unsigned default '0',
431 -- Total number of edits performed.
432 ss_total_edits bigint(20) unsigned default '0',
434 -- An approximate count of pages matching the following criteria:
437 -- * contains the text '[['
438 -- See isCountable() in includes/Article.php
439 ss_good_articles bigint(20) unsigned default '0',
441 -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
442 ss_total_pages bigint(20) default -1,
444 -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
445 ss_users bigint(20) default -1,
447 -- Deprecated, no longer updated as of 1.5
448 ss_admins int(10) default -1,
450 UNIQUE KEY ss_row_id (ss_row_id)
455 -- Stores an ID for every time any article is visited;
456 -- depending on $wgHitcounterUpdateFreq, it is
457 -- periodically cleared and the page_counter column
458 -- in the page table updated for the all articles
459 -- that have been visited.)
461 CREATE TABLE /*$wgDBprefix*/hitcounter (
462 hc_id INTEGER UNSIGNED NOT NULL
463 ) TYPE=HEAP MAX_ROWS=25000;
467 -- The internet is full of jerks, alas. Sometimes it's handy
468 -- to block a vandal or troll account.
470 CREATE TABLE /*$wgDBprefix*/ipblocks (
471 -- Primary key, introduced for privacy.
472 ipb_id int(8) NOT NULL auto_increment,
474 -- Blocked IP address in dotted-quad form or user name.
475 ipb_address varchar(40) binary NOT NULL default '',
477 -- Blocked user ID or 0 for IP blocks.
478 ipb_user int(8) unsigned NOT NULL default '0',
480 -- User ID who made the block.
481 ipb_by int(8) unsigned NOT NULL default '0',
483 -- Text comment made by blocker.
484 ipb_reason tinyblob NOT NULL default '',
486 -- Creation (or refresh) date in standard YMDHMS form.
487 -- IP blocks expire automatically.
488 ipb_timestamp char(14) binary NOT NULL default '',
490 -- Indicates that the IP address was banned because a banned
491 -- user accessed a page through it. If this is 1, ipb_address
492 -- will be hidden, and the block identified by block ID number.
493 ipb_auto tinyint(1) NOT NULL default '0',
495 -- Time at which the block will expire.
496 ipb_expiry char(14) binary NOT NULL default '',
498 PRIMARY KEY ipb_id (ipb_id),
499 INDEX ipb_address (ipb_address),
500 INDEX ipb_user (ipb_user)
506 -- Uploaded images and other files.
508 CREATE TABLE /*$wgDBprefix*/image (
510 -- This is also the title of the associated description page,
511 -- which will be in namespace 6 (NS_IMAGE).
512 img_name varchar(255) binary NOT NULL default '',
514 -- File size in bytes.
515 img_size int(8) unsigned NOT NULL default '0',
517 -- For images, size in pixels.
518 img_width int(5) NOT NULL default '0',
519 img_height int(5) NOT NULL default '0',
521 -- Extracted EXIF metadata stored as a serialized PHP array.
522 img_metadata mediumblob NOT NULL,
524 -- For images, bits per pixel if known.
525 img_bits int(3) NOT NULL default '0',
527 -- Media type as defined by the MEDIATYPE_xxx constants
528 img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
530 -- major part of a MIME media type as defined by IANA
531 -- see http://www.iana.org/assignments/media-types/
532 img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
534 -- minor part of a MIME media type as defined by IANA
535 -- the minor parts are not required to adher to any standard
536 -- but should be consistent throughout the database
537 -- see http://www.iana.org/assignments/media-types/
538 img_minor_mime varchar(32) NOT NULL default "unknown",
540 -- Description field as entered by the uploader.
541 -- This is displayed in image upload history and logs.
542 img_description tinyblob NOT NULL default '',
544 -- user_id and user_name of uploader.
545 img_user int(5) unsigned NOT NULL default '0',
546 img_user_text varchar(255) binary NOT NULL default '',
548 -- Time of the upload.
549 img_timestamp char(14) binary NOT NULL default '',
551 PRIMARY KEY img_name (img_name),
553 -- Used by Special:Imagelist for sort-by-size
554 INDEX img_size (img_size),
556 -- Used by Special:Newimages and Special:Imagelist
557 INDEX img_timestamp (img_timestamp)
562 -- Previous revisions of uploaded files.
563 -- Awkwardly, image rows have to be moved into
564 -- this table at re-upload time.
566 CREATE TABLE /*$wgDBprefix*/oldimage (
567 -- Base filename: key to image.img_name
568 oi_name varchar(255) binary NOT NULL default '',
570 -- Filename of the archived file.
571 -- This is generally a timestamp and '!' prepended to the base name.
572 oi_archive_name varchar(255) binary NOT NULL default '',
574 -- Other fields as in image...
575 oi_size int(8) unsigned NOT NULL default 0,
576 oi_width int(5) NOT NULL default 0,
577 oi_height int(5) NOT NULL default 0,
578 oi_bits int(3) NOT NULL default 0,
579 oi_description tinyblob NOT NULL default '',
580 oi_user int(5) unsigned NOT NULL default '0',
581 oi_user_text varchar(255) binary NOT NULL default '',
582 oi_timestamp char(14) binary NOT NULL default '',
584 INDEX oi_name (oi_name(10))
590 -- Primarily a summary table for Special:Recentchanges,
591 -- this table contains some additional info on edits from
592 -- the last few days.
594 CREATE TABLE /*$wgDBprefix*/recentchanges (
595 rc_id int(8) NOT NULL auto_increment,
596 rc_timestamp varchar(14) binary NOT NULL default '',
597 rc_cur_time varchar(14) binary NOT NULL default '',
600 rc_user int(10) unsigned NOT NULL default '0',
601 rc_user_text varchar(255) binary NOT NULL default '',
603 -- When pages are renamed, their RC entries do _not_ change.
604 rc_namespace int NOT NULL default '0',
605 rc_title varchar(255) binary NOT NULL default '',
608 rc_comment varchar(255) binary NOT NULL default '',
609 rc_minor tinyint(3) unsigned NOT NULL default '0',
611 -- Edits by user accounts with the 'bot' rights key are
612 -- marked with a 1 here, and will be hidden from the
614 rc_bot tinyint(3) unsigned NOT NULL default '0',
616 rc_new tinyint(3) unsigned NOT NULL default '0',
618 -- Key to page_id (was cur_id prior to 1.5).
619 -- This will keep links working after moves while
620 -- retaining the at-the-time name in the changes list.
621 rc_cur_id int(10) unsigned NOT NULL default '0',
623 -- rev_id of the given revision
624 rc_this_oldid int(10) unsigned NOT NULL default '0',
626 -- rev_id of the prior revision, for generating diff links.
627 rc_last_oldid int(10) unsigned NOT NULL default '0',
629 -- These may no longer be used, with the new move log.
630 rc_type tinyint(3) unsigned NOT NULL default '0',
631 rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
632 rc_moved_to_title varchar(255) binary NOT NULL default '',
634 -- If the Recent Changes Patrol option is enabled,
635 -- users may mark edits as having been reviewed to
636 -- remove a warning flag on the RC list.
637 -- A value of 1 indicates the page has been reviewed.
638 rc_patrolled tinyint(3) unsigned NOT NULL default '0',
640 -- Recorded IP address the edit was made from, if the
641 -- $wgPutIPinRC option is enabled.
642 rc_ip char(15) NOT NULL default '',
644 PRIMARY KEY rc_id (rc_id),
645 INDEX rc_timestamp (rc_timestamp),
646 INDEX rc_namespace_title (rc_namespace, rc_title),
647 INDEX rc_cur_id (rc_cur_id),
648 INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp),
653 CREATE TABLE /*$wgDBprefix*/watchlist (
655 wl_user int(5) unsigned NOT NULL,
657 -- Key to page_namespace/page_title
658 -- Note that users may watch patches which do not exist yet,
659 -- or existed in the past but have been deleted.
660 wl_namespace int NOT NULL default '0',
661 wl_title varchar(255) binary NOT NULL default '',
663 -- Timestamp when user was last sent a notification e-mail;
664 -- cleared when the user visits the page.
665 -- FIXME: add proper null support etc
666 wl_notificationtimestamp varchar(14) binary NOT NULL default '0',
668 UNIQUE KEY (wl_user, wl_namespace, wl_title),
669 KEY namespace_title (wl_namespace,wl_title)
675 -- Used by texvc math-rendering extension to keep track
676 -- of previously-rendered items.
678 CREATE TABLE /*$wgDBprefix*/math (
679 -- Binary MD5 hash of the latex fragment, used as an identifier key.
680 math_inputhash varchar(16) NOT NULL,
682 -- Not sure what this is, exactly...
683 math_outputhash varchar(16) NOT NULL,
685 -- texvc reports how well it thinks the HTML conversion worked;
686 -- if it's a low level the PNG rendering may be preferred.
687 math_html_conservativeness tinyint(1) NOT NULL,
689 -- HTML output from texvc, if any
692 -- MathML output from texvc, if any
695 UNIQUE KEY math_inputhash (math_inputhash)
700 -- When using the default MySQL search backend, page titles
701 -- and text are munged to strip markup, do Unicode case folding,
702 -- and prepare the result for MySQL's fulltext index.
704 -- This table must be MyISAM; InnoDB does not support the needed
707 CREATE TABLE /*$wgDBprefix*/searchindex (
709 si_page int(8) unsigned NOT NULL,
711 -- Munged version of title
712 si_title varchar(255) NOT NULL default '',
714 -- Munged version of body text
715 si_text mediumtext NOT NULL default '',
717 UNIQUE KEY (si_page),
718 FULLTEXT si_title (si_title),
719 FULLTEXT si_text (si_text)
724 -- Recognized interwiki link prefixes
726 CREATE TABLE /*$wgDBprefix*/interwiki (
727 -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
728 iw_prefix char(32) NOT NULL,
730 -- The URL of the wiki, with "$1" as a placeholder for an article name.
731 -- Any spaces in the name will be transformed to underscores before
733 iw_url char(127) NOT NULL,
735 -- A boolean value indicating whether the wiki is in this project
736 -- (used, for example, to detect redirect loops)
737 iw_local BOOL NOT NULL,
739 -- Boolean value indicating whether interwiki transclusions are allowed.
740 iw_trans TINYINT(1) NOT NULL DEFAULT 0,
742 UNIQUE KEY iw_prefix (iw_prefix)
747 -- Used for caching expensive grouped queries
749 CREATE TABLE /*$wgDBprefix*/querycache (
750 -- A key name, generally the base name of of the special page.
751 qc_type char(32) NOT NULL,
753 -- Some sort of stored value. Sizes, counts...
754 qc_value int(5) unsigned NOT NULL default '0',
756 -- Target namespace+title
757 qc_namespace int NOT NULL default '0',
758 qc_title char(255) binary NOT NULL default '',
760 KEY (qc_type,qc_value)
765 -- For a few generic cache operations if not using Memcached
767 CREATE TABLE /*$wgDBprefix*/objectcache (
768 keyname char(255) binary not null default '',
771 unique key (keyname),
776 -- For article validation
777 CREATE TABLE /*$wgDBprefix*/validate (
778 `val_user` int(11) NOT NULL default '0',
779 `val_page` int(11) unsigned NOT NULL default '0',
780 `val_revision` int(11) unsigned NOT NULL default '0',
781 `val_type` int(11) unsigned NOT NULL default '0',
782 `val_value` int(11) default '0',
783 `val_comment` varchar(255) NOT NULL default '',
784 `val_ip` varchar(20) NOT NULL default '',
785 KEY `val_user` (`val_user`,`val_revision`)
789 CREATE TABLE /*$wgDBprefix*/logging (
790 -- Symbolic keys for the general log type and the action type
791 -- within the log. The output format will be controlled by the
792 -- action field, but only the type controls categorization.
793 log_type char(10) NOT NULL default '',
794 log_action char(10) NOT NULL default '',
797 log_timestamp char(14) NOT NULL default '19700101000000',
799 -- The user who performed this action; key to user_id
800 log_user int unsigned NOT NULL default 0,
802 -- Key to the page affected. Where a user is the target,
803 -- this will point to the user page.
804 log_namespace int NOT NULL default 0,
805 log_title varchar(255) binary NOT NULL default '',
807 -- Freeform text. Interpreted as edit history comments.
808 log_comment varchar(255) NOT NULL default '',
810 -- LF separated list of miscellaneous parameters
811 log_params blob NOT NULL default '',
813 KEY type_time (log_type, log_timestamp),
814 KEY user_time (log_user, log_timestamp),
815 KEY page_time (log_namespace, log_title, log_timestamp)
823 -- Hold group name and description
824 --CREATE TABLE /*$wgDBprefix*/groups (
825 -- gr_id int(5) unsigned NOT NULL auto_increment,
826 -- gr_name varchar(50) NOT NULL default '',
827 -- gr_description varchar(255) NOT NULL default '',
828 -- gr_rights tinyblob,
829 -- PRIMARY KEY (gr_id)