1 -- Experimental table definitions for MySQL 4.1 and 5.0 with
2 -- explicit character set support. Not fully tested, may have
5 -- TODO: Test various fields
6 -- TODO: Anything else need to be moved to VARBINARY and BLOB?
7 -- TODO: UCS-2 better than UTF-8?
8 -- TODO: Find out how to get 4-byte UTF-8 chars into MySQL...
9 -- An alternate UCS-2 that does UTF-16 conversion would work.
10 -- TODO: Work on collation usage
12 -- ------------------------------------------------------------
14 -- SQL to create the initial tables for the MediaWiki database.
15 -- This is read and executed by the install script; you should
16 -- not have to run it by itself unless doing a manual install.
21 -- If possible, create tables as InnoDB to benefit from the
22 -- superior resiliency against crashes and ability to read
23 -- during writes (and write during reads!)
25 -- Only the 'searchindex' table requires MyISAM due to the
26 -- requirement for fulltext index support, which is missing
30 -- The MySQL table backend for MediaWiki currently uses
31 -- 14-character CHAR or VARCHAR fields to store timestamps.
32 -- The format is YYYYMMDDHHMMSS, which is derived from the
33 -- text format of MySQL's TIMESTAMP fields.
35 -- Historically TIMESTAMP fields were used, but abandoned
36 -- in early 2002 after a lot of trouble with the fields
39 -- The PostgreSQL backend uses DATETIME fields for timestamps,
40 -- and we will migrate the MySQL definitions at some point as
44 -- The /*$wgDBprefix*/ comments in this and other files are
45 -- replaced with the defined table prefix by the installer
46 -- and updater scripts. If you are installing or running
47 -- updates manually, you will need to manually insert the
48 -- table prefix if any when running these scripts.
53 -- The user table contains basic account information,
54 -- authentication keys, etc.
56 -- Some multi-wiki sites may share a single central user table
57 -- between separate wikis using the $wgSharedDB setting.
59 -- Note that when a external authentication plugin is used,
60 -- user table entries still need to be created to store
61 -- preferences and to key tracking information in the other
64 CREATE TABLE /*$wgDBprefix*/user (
65 user_id
int(5) unsigned
NOT NULL auto_increment
,
67 -- Usernames must be unique, must not be in the form of
68 -- an IP address. _Shouldn't_ allow slashes or case
69 -- conflicts. Spaces are allowed, and are _not_ converted
70 -- to underscores like titles. See the User::newFromName() for
71 -- the specific tests that usernames have to pass.
72 user_name
varchar(255) binary NOT NULL default '',
74 -- Optional 'real name' to be displayed in credit listings
75 user_real_name
varchar(255) binary NOT NULL default '',
77 -- Password hashes, normally hashed like so:
78 -- MD5(CONCAT(user_id,'-',MD5(plaintext_password))), see
79 -- wfEncryptPassword() in GlobalFunctions.php
80 user_password tinyblob
NOT NULL default '',
82 -- When using 'mail me a new password', a random
83 -- password is generated and the hash stored here.
84 -- The previous password is left in place until
85 -- someone actually logs in with the new password,
86 -- at which point the hash is moved to user_password
87 -- and the old password is invalidated.
88 user_newpassword tinyblob
NOT NULL default '',
90 -- Note: email should be restricted, not public info.
91 -- Same with passwords.
92 user_email tinytext
NOT NULL default '',
94 -- Newline-separated list of name=value defining the user
96 user_options
blob NOT NULL default '',
98 -- This is a timestamp which is updated when a user
99 -- logs in, logs out, changes preferences, or performs
100 -- some other action requiring HTML cache invalidation
101 -- to ensure that the UI is updated.
102 user_touched
char(14) binary NOT NULL default '',
104 -- A pseudorandomly generated value that is stored in
105 -- a cookie when the "remember password" feature is
106 -- used (previously, a hash of the password was used, but
107 -- this was vulnerable to cookie-stealing attacks)
108 user_token
char(32) binary NOT NULL default '',
110 -- Initially NULL; when a user's e-mail address has been
111 -- validated by returning with a mailed token, this is
112 -- set to the current timestamp.
113 user_email_authenticated
CHAR(14) BINARY,
115 -- Randomly generated token created when the e-mail address
116 -- is set and a confirmation test mail sent.
117 user_email_token
CHAR(32) BINARY,
119 -- Expiration date for the user_email_token
120 user_email_token_expires
CHAR(14) BINARY,
122 -- Timestamp of account registration.
123 -- Accounts predating this schema addition may contain NULL.
124 user_registration
CHAR(14) BINARY,
126 PRIMARY KEY user_id (user_id
),
127 UNIQUE INDEX user_name (user_name
),
128 INDEX (user_email_token
)
130 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
133 -- User permissions have been broken out to a separate table;
134 -- this allows sites with a shared user table to have different
135 -- permissions assigned to a user in each project.
137 -- This table replaces the old user_rights field which used a
138 -- comma-separated blob.
140 CREATE TABLE /*$wgDBprefix*/user_groups (
142 ug_user
int(5) unsigned
NOT NULL default '0',
144 -- Group names are short symbolic string keys.
145 -- The set of group names is open-ended, though in practice
146 -- only some predefined ones are likely to be used.
148 -- At runtime $wgGroupPermissions will associate group keys
149 -- with particular permissions. A user will have the combined
150 -- permissions of any group they're explicitly in, plus
151 -- the implicit '*' and 'user' groups.
152 ug_group
char(16) NOT NULL default '',
154 PRIMARY KEY (ug_user
,ug_group
),
156 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
158 -- Stores notifications of user talk page changes, for the display
159 -- of the "you have new messages" box
160 CREATE TABLE /*$wgDBprefix*/user_newtalk (
161 -- Key to user.user_id
162 user_id
int(5) NOT NULL default '0',
163 -- If the user is an anonymous user hir IP address is stored here
164 -- since the user_id of 0 is ambiguous
165 user_ip
varchar(40) NOT NULL default '',
166 INDEX user_id (user_id
),
167 INDEX user_ip (user_ip
)
168 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
172 -- Core of the wiki: each page has an entry here which identifies
173 -- it by title and contains some essential metadata.
175 CREATE TABLE /*$wgDBprefix*/page (
176 -- Unique identifier number. The page_id will be preserved across
177 -- edits and rename operations, but not deletions and recreations.
178 page_id
int(8) unsigned
NOT NULL auto_increment
,
180 -- A page name is broken into a namespace and a title.
181 -- The namespace keys are UI-language-independent constants,
182 -- defined in includes/Defines.php
183 page_namespace
int NOT NULL,
185 -- The rest of the title, as text.
186 -- Spaces are transformed into underscores in title storage.
187 page_title
varchar(255) binary NOT NULL,
189 -- Comma-separated set of permission keys indicating who
190 -- can move or edit the page.
191 page_restrictions tinyblob
NOT NULL default '',
193 -- Number of times this page has been viewed.
194 page_counter
bigint(20) unsigned
NOT NULL default '0',
196 -- 1 indicates the article is a redirect.
197 page_is_redirect
tinyint(1) unsigned
NOT NULL default '0',
199 -- 1 indicates this is a new entry, with only one edit.
200 -- Not all pages with one edit are new pages.
201 page_is_new
tinyint(1) unsigned
NOT NULL default '0',
203 -- Random value between 0 and 1, used for Special:Randompage
204 page_random
real unsigned
NOT NULL,
206 -- This timestamp is updated whenever the page changes in
207 -- a way requiring it to be re-rendered, invalidating caches.
208 -- Aside from editing this includes permission changes,
209 -- creation or deletion of linked pages, and alteration
210 -- of contained templates.
211 page_touched
char(14) binary NOT NULL default '',
213 -- Handy key to revision.rev_id of the current revision.
214 -- This may be 0 during page creation, but that shouldn't
215 -- happen outside of a transaction... hopefully.
216 page_latest
int(8) unsigned
NOT NULL,
218 -- Uncompressed length in bytes of the page's current source text.
219 page_len
int(8) unsigned
NOT NULL,
221 PRIMARY KEY page_id (page_id
),
222 UNIQUE INDEX name_title (page_namespace
,page_title
),
224 -- Special-purpose indexes
228 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
231 -- Every edit of a page creates also a revision row.
232 -- This stores metadata about the revision, and a reference
233 -- to the text storage backend.
235 CREATE TABLE /*$wgDBprefix*/revision (
236 rev_id
int(8) unsigned
NOT NULL auto_increment
,
238 -- Key to page_id. This should _never_ be invalid.
239 rev_page
int(8) unsigned
NOT NULL,
241 -- Key to text.old_id, where the actual bulk text is stored.
242 -- It's possible for multiple revisions to use the same text,
243 -- for instance revisions where only metadata is altered
244 -- or a rollback to a previous version.
245 rev_text_id
int(8) unsigned
NOT NULL,
247 -- Text comment summarizing the change.
248 -- This text is shown in the history and other changes lists,
249 -- rendered in a subset of wiki markup by Linker::formatComment()
250 rev_comment tinyblob
NOT NULL default '',
252 -- Key to user.user_id of the user who made this edit.
253 -- Stores 0 for anonymous edits and for some mass imports.
254 rev_user
int(5) unsigned
NOT NULL default '0',
256 -- Text username or IP address of the editor.
257 rev_user_text
varchar(255) binary NOT NULL default '',
260 rev_timestamp
char(14) binary NOT NULL default '',
262 -- Records whether the user marked the 'minor edit' checkbox.
263 -- Many automated edits are marked as minor.
264 rev_minor_edit
tinyint(1) unsigned
NOT NULL default '0',
266 -- Not yet used; reserved for future changes to the deletion system.
267 rev_deleted
tinyint(1) unsigned
NOT NULL default '0',
269 PRIMARY KEY rev_page_id (rev_page
, rev_id
),
270 UNIQUE INDEX rev_id (rev_id
),
271 INDEX rev_timestamp (rev_timestamp
),
272 INDEX page_timestamp (rev_page
,rev_timestamp
),
273 INDEX user_timestamp (rev_user
,rev_timestamp
),
274 INDEX usertext_timestamp (rev_user_text
,rev_timestamp
)
276 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
280 -- Holds text of individual page revisions.
282 -- Field names are a holdover from the 'old' revisions table in
283 -- MediaWiki 1.4 and earlier: an upgrade will transform that
284 -- table into the 'text' table to minimize unnecessary churning
285 -- and downtime. If upgrading, the other fields will be left unused.
287 CREATE TABLE /*$wgDBprefix*/text (
288 -- Unique text storage key number.
289 -- Note that the 'oldid' parameter used in URLs does *not*
290 -- refer to this number anymore, but to rev_id.
292 -- revision.rev_text_id is a key to this column
293 old_id
int(8) unsigned
NOT NULL auto_increment
,
295 -- Depending on the contents of the old_flags field, the text
296 -- may be convenient plain text, or it may be funkily encoded.
297 old_text mediumblob
NOT NULL default '',
299 -- Comma-separated list of flags:
300 -- gzip: text is compressed with PHP's gzdeflate() function.
301 -- utf8: text was stored as UTF-8.
302 -- If $wgLegacyEncoding option is on, rows *without* this flag
303 -- will be converted to UTF-8 transparently at load time.
304 -- object: text field contained a serialized PHP object.
305 -- The object either contains multiple versions compressed
306 -- together to achieve a better compression ratio, or it refers
307 -- to another row where the text can be found.
308 old_flags tinyblob
NOT NULL default '',
310 PRIMARY KEY old_id (old_id
)
312 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
315 -- Holding area for deleted articles, which may be viewed
316 -- or restored by admins through the Special:Undelete interface.
317 -- The fields generally correspond to the page, revision, and text
318 -- fields, with several caveats.
320 CREATE TABLE /*$wgDBprefix*/archive (
321 ar_namespace
int NOT NULL default '0',
322 ar_title
varchar(255) binary NOT NULL default '',
324 -- Newly deleted pages will not store text in this table,
325 -- but will reference the separately existing text rows.
326 -- This field is retained for backwards compatibility,
327 -- so old archived pages will remain accessible after
328 -- upgrading from 1.4 to 1.5.
329 -- Text may be gzipped or otherwise funky.
330 ar_text mediumblob
NOT NULL default '',
332 -- Basic revision stuff...
333 ar_comment tinyblob
NOT NULL default '',
334 ar_user
int(5) unsigned
NOT NULL default '0',
335 ar_user_text
varchar(255) binary NOT NULL,
336 ar_timestamp
char(14) binary NOT NULL default '',
337 ar_minor_edit
tinyint(1) NOT NULL default '0',
340 ar_flags tinyblob
NOT NULL default '',
342 -- When revisions are deleted, their unique rev_id is stored
343 -- here so it can be retained after undeletion. This is necessary
344 -- to retain permalinks to given revisions after accidental delete
345 -- cycles or messy operations like history merges.
347 -- Old entries from 1.4 will be NULL here, and a new rev_id will
348 -- be created on undeletion for those revisions.
349 ar_rev_id
int(8) unsigned
,
351 -- For newly deleted revisions, this is the text.old_id key to the
352 -- actual stored text. To avoid breaking the block-compression scheme
353 -- and otherwise making storage changes harder, the actual text is
354 -- *not* deleted from the text table, merely hidden by removal of the
355 -- page and revision entries.
357 -- Old entries deleted under 1.2-1.4 will have NULL here, and their
358 -- ar_text and ar_flags fields will be used to create a new text
359 -- row upon undeletion.
360 ar_text_id
int(8) unsigned
,
362 KEY name_title_timestamp (ar_namespace
,ar_title
,ar_timestamp
)
364 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
368 -- Track page-to-page hyperlinks within the wiki.
370 CREATE TABLE /*$wgDBprefix*/pagelinks (
371 -- Key to the page_id of the page containing the link.
372 pl_from
int(8) unsigned
NOT NULL default '0',
374 -- Key to page_namespace/page_title of the target page.
375 -- The target page may or may not exist, and due to renames
376 -- and deletions may refer to different page records as time
378 pl_namespace
int NOT NULL default '0',
379 pl_title
varchar(255) binary NOT NULL default '',
381 UNIQUE KEY pl_from(pl_from
,pl_namespace
,pl_title
),
382 KEY (pl_namespace
,pl_title
)
384 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
388 -- Track template inclusions.
390 CREATE TABLE /*$wgDBprefix*/templatelinks (
391 -- Key to the page_id of the page containing the link.
392 tl_from
int(8) unsigned
NOT NULL default '0',
394 -- Key to page_namespace/page_title of the target page.
395 -- The target page may or may not exist, and due to renames
396 -- and deletions may refer to different page records as time
398 tl_namespace
int NOT NULL default '0',
399 tl_title
varchar(255) binary NOT NULL default '',
401 UNIQUE KEY tl_from(tl_from
,tl_namespace
,tl_title
),
402 KEY (tl_namespace
,tl_title
)
404 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
408 -- Track links to images *used inline*
409 -- We don't distinguish live from broken links here, so
410 -- they do not need to be changed on upload/removal.
412 CREATE TABLE /*$wgDBprefix*/imagelinks (
413 -- Key to page_id of the page containing the image / media link.
414 il_from
int(8) unsigned
NOT NULL default '0',
416 -- Filename of target image.
417 -- This is also the page_title of the file's description page;
418 -- all such pages are in namespace 6 (NS_IMAGE).
419 il_to
varchar(255) binary NOT NULL default '',
421 UNIQUE KEY il_from(il_from
,il_to
),
424 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
427 -- Track category inclusions *used inline*
428 -- This tracks a single level of category membership
429 -- (folksonomic tagging, really).
431 CREATE TABLE /*$wgDBprefix*/categorylinks (
432 -- Key to page_id of the page defined as a category member.
433 cl_from
int(8) unsigned
NOT NULL default '0',
435 -- Name of the category.
436 -- This is also the page_title of the category's description page;
437 -- all such pages are in namespace 14 (NS_CATEGORY).
438 cl_to
varchar(255) binary NOT NULL default '',
440 -- The title of the linking page, or an optional override
441 -- to determine sort order. Sorting is by binary order, which
442 -- isn't always ideal, but collations seem to be an exciting
443 -- and dangerous new world in MySQL...
445 -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
446 -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
447 -- To sort properly on the shorter key, this field needs to be
448 -- the same shortness.
449 cl_sortkey
varchar(86) binary NOT NULL default '',
451 -- This isn't really used at present. Provided for an optional
452 -- sorting method by approximate addition time.
453 cl_timestamp
timestamp NOT NULL,
455 UNIQUE KEY cl_from(cl_from
,cl_to
),
457 -- We always sort within a given category...
458 KEY cl_sortkey(cl_to
,cl_sortkey
),
461 KEY cl_timestamp(cl_to
,cl_timestamp
)
463 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
466 -- Contains a single row with some aggregate info
467 -- on the state of the site.
469 CREATE TABLE /*$wgDBprefix*/site_stats (
470 -- The single row should contain 1 here.
471 ss_row_id
int(8) unsigned
NOT NULL,
473 -- Total number of page views, if hit counters are enabled.
474 ss_total_views
bigint(20) unsigned
default '0',
476 -- Total number of edits performed.
477 ss_total_edits
bigint(20) unsigned
default '0',
479 -- An approximate count of pages matching the following criteria:
482 -- * contains the text '[['
483 -- See Article::isCountable() in includes/Article.php
484 ss_good_articles
bigint(20) unsigned
default '0',
486 -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
487 ss_total_pages
bigint(20) default '-1',
489 -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
490 ss_users
bigint(20) default '-1',
492 -- Deprecated, no longer updated as of 1.5
493 ss_admins
int(10) default '-1',
495 UNIQUE KEY ss_row_id (ss_row_id
)
500 -- Stores an ID for every time any article is visited;
501 -- depending on $wgHitcounterUpdateFreq, it is
502 -- periodically cleared and the page_counter column
503 -- in the page table updated for the all articles
504 -- that have been visited.)
506 CREATE TABLE /*$wgDBprefix*/hitcounter (
507 hc_id
INTEGER UNSIGNED
NOT NULL
508 ) TYPE=HEAP MAX_ROWS
=25000;
512 -- The internet is full of jerks, alas. Sometimes it's handy
513 -- to block a vandal or troll account.
515 CREATE TABLE /*$wgDBprefix*/ipblocks (
516 -- Primary key, introduced for privacy.
517 ipb_id
int(8) NOT NULL auto_increment
,
519 -- Blocked IP address in dotted-quad form or user name.
520 ipb_address
varchar(40) binary NOT NULL default '',
522 -- Blocked user ID or 0 for IP blocks.
523 ipb_user
int(8) unsigned
NOT NULL default '0',
525 -- User ID who made the block.
526 ipb_by
int(8) unsigned
NOT NULL default '0',
528 -- Text comment made by blocker.
529 ipb_reason tinyblob
NOT NULL default '',
531 -- Creation (or refresh) date in standard YMDHMS form.
532 -- IP blocks expire automatically.
533 ipb_timestamp
char(14) binary NOT NULL default '',
535 -- Indicates that the IP address was banned because a banned
536 -- user accessed a page through it. If this is 1, ipb_address
537 -- will be hidden, and the block identified by block ID number.
538 ipb_auto
tinyint(1) NOT NULL default '0',
540 -- Time at which the block will expire.
541 ipb_expiry
char(14) binary NOT NULL default '',
543 -- Start and end of an address range, in hexadecimal
544 -- Size chosen to allow IPv6
545 ipb_range_start
varchar(32) NOT NULL default '',
546 ipb_range_end
varchar(32) NOT NULL default '',
548 PRIMARY KEY ipb_id (ipb_id
),
549 INDEX ipb_address (ipb_address
),
550 INDEX ipb_user (ipb_user
),
551 INDEX ipb_range (ipb_range_start(8), ipb_range_end(8))
553 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
557 -- Uploaded images and other files.
559 CREATE TABLE /*$wgDBprefix*/image (
561 -- This is also the title of the associated description page,
562 -- which will be in namespace 6 (NS_IMAGE).
563 img_name
varchar(255) binary NOT NULL default '',
565 -- File size in bytes.
566 img_size
int(8) unsigned
NOT NULL default '0',
568 -- For images, size in pixels.
569 img_width
int(5) NOT NULL default '0',
570 img_height
int(5) NOT NULL default '0',
572 -- Extracted EXIF metadata stored as a serialized PHP array.
573 img_metadata mediumblob
NOT NULL,
575 -- For images, bits per pixel if known.
576 img_bits
int(3) NOT NULL default '0',
578 -- Media type as defined by the MEDIATYPE_xxx constants
579 img_media_type
ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
581 -- major part of a MIME media type as defined by IANA
582 -- see http://www.iana.org/assignments/media-types/
583 img_major_mime
ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
585 -- minor part of a MIME media type as defined by IANA
586 -- the minor parts are not required to adher to any standard
587 -- but should be consistent throughout the database
588 -- see http://www.iana.org/assignments/media-types/
589 img_minor_mime
varchar(32) NOT NULL default "unknown",
591 -- Description field as entered by the uploader.
592 -- This is displayed in image upload history and logs.
593 img_description tinyblob
NOT NULL default '',
595 -- user_id and user_name of uploader.
596 img_user
int(5) unsigned
NOT NULL default '0',
597 img_user_text
varchar(255) binary NOT NULL default '',
599 -- Time of the upload.
600 img_timestamp
char(14) binary NOT NULL default '',
602 PRIMARY KEY img_name (img_name
),
604 -- Used by Special:Imagelist for sort-by-size
605 INDEX img_size (img_size
),
607 -- Used by Special:Newimages and Special:Imagelist
608 INDEX img_timestamp (img_timestamp
)
610 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
613 -- Previous revisions of uploaded files.
614 -- Awkwardly, image rows have to be moved into
615 -- this table at re-upload time.
617 CREATE TABLE /*$wgDBprefix*/oldimage (
618 -- Base filename: key to image.img_name
619 oi_name
varchar(255) binary NOT NULL default '',
621 -- Filename of the archived file.
622 -- This is generally a timestamp and '!' prepended to the base name.
623 oi_archive_name
varchar(255) binary NOT NULL default '',
625 -- Other fields as in image...
626 oi_size
int(8) unsigned
NOT NULL default 0,
627 oi_width
int(5) NOT NULL default 0,
628 oi_height
int(5) NOT NULL default 0,
629 oi_bits
int(3) NOT NULL default 0,
630 oi_description tinyblob
NOT NULL default '',
631 oi_user
int(5) unsigned
NOT NULL default '0',
632 oi_user_text
varchar(255) binary NOT NULL default '',
633 oi_timestamp
char(14) binary NOT NULL default '',
635 INDEX oi_name (oi_name(10))
637 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
641 -- Primarily a summary table for Special:Recentchanges,
642 -- this table contains some additional info on edits from
643 -- the last few days, see Article::editUpdates()
645 CREATE TABLE /*$wgDBprefix*/recentchanges (
646 rc_id
int(8) NOT NULL auto_increment
,
647 rc_timestamp
varchar(14) binary NOT NULL default '',
648 rc_cur_time
varchar(14) binary NOT NULL default '',
651 rc_user
int(10) unsigned
NOT NULL default '0',
652 rc_user_text
varchar(255) binary NOT NULL default '',
654 -- When pages are renamed, their RC entries do _not_ change.
655 rc_namespace
int NOT NULL default '0',
656 rc_title
varchar(255) binary NOT NULL default '',
659 rc_comment
varchar(255) binary NOT NULL default '',
660 rc_minor
tinyint(3) unsigned
NOT NULL default '0',
662 -- Edits by user accounts with the 'bot' rights key are
663 -- marked with a 1 here, and will be hidden from the
665 rc_bot
tinyint(3) unsigned
NOT NULL default '0',
667 rc_new
tinyint(3) unsigned
NOT NULL default '0',
669 -- Key to page_id (was cur_id prior to 1.5).
670 -- This will keep links working after moves while
671 -- retaining the at-the-time name in the changes list.
672 rc_cur_id
int(10) unsigned
NOT NULL default '0',
674 -- rev_id of the given revision
675 rc_this_oldid
int(10) unsigned
NOT NULL default '0',
677 -- rev_id of the prior revision, for generating diff links.
678 rc_last_oldid
int(10) unsigned
NOT NULL default '0',
680 -- These may no longer be used, with the new move log.
681 rc_type
tinyint(3) unsigned
NOT NULL default '0',
682 rc_moved_to_ns
tinyint(3) unsigned
NOT NULL default '0',
683 rc_moved_to_title
varchar(255) binary NOT NULL default '',
685 -- If the Recent Changes Patrol option is enabled,
686 -- users may mark edits as having been reviewed to
687 -- remove a warning flag on the RC list.
688 -- A value of 1 indicates the page has been reviewed.
689 rc_patrolled
tinyint(3) unsigned
NOT NULL default '0',
691 -- Recorded IP address the edit was made from, if the
692 -- $wgPutIPinRC option is enabled.
693 rc_ip
char(15) NOT NULL default '',
695 PRIMARY KEY rc_id (rc_id
),
696 INDEX rc_timestamp (rc_timestamp
),
697 INDEX rc_namespace_title (rc_namespace
, rc_title
),
698 INDEX rc_cur_id (rc_cur_id
),
699 INDEX new_name_timestamp(rc_new
,rc_namespace
,rc_timestamp
),
702 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
704 CREATE TABLE /*$wgDBprefix*/watchlist (
705 -- Key to user.user_id
706 wl_user
int(5) unsigned
NOT NULL,
708 -- Key to page_namespace/page_title
709 -- Note that users may watch pages which do not exist yet,
710 -- or existed in the past but have been deleted.
711 wl_namespace
int NOT NULL default '0',
712 wl_title
varchar(255) binary NOT NULL default '',
714 -- Timestamp when user was last sent a notification e-mail;
715 -- cleared when the user visits the page.
716 wl_notificationtimestamp
varchar(14) binary,
718 UNIQUE KEY (wl_user
, wl_namespace
, wl_title
),
719 KEY namespace_title (wl_namespace
,wl_title
)
721 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
725 -- Used by the math module to keep track
726 -- of previously-rendered items.
728 CREATE TABLE /*$wgDBprefix*/math (
729 -- Binary MD5 hash of the latex fragment, used as an identifier key.
730 math_inputhash
varbinary(16) NOT NULL,
732 -- Not sure what this is, exactly...
733 math_outputhash
varbinary(16) NOT NULL,
735 -- texvc reports how well it thinks the HTML conversion worked;
736 -- if it's a low level the PNG rendering may be preferred.
737 math_html_conservativeness
tinyint(1) NOT NULL,
739 -- HTML output from texvc, if any
742 -- MathML output from texvc, if any
745 UNIQUE KEY math_inputhash (math_inputhash
)
747 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
750 -- When using the default MySQL search backend, page titles
751 -- and text are munged to strip markup, do Unicode case folding,
752 -- and prepare the result for MySQL's fulltext index.
754 -- This table must be MyISAM; InnoDB does not support the needed
757 CREATE TABLE /*$wgDBprefix*/searchindex (
759 si_page
int(8) unsigned
NOT NULL,
761 -- Munged version of title
762 si_title
varchar(255) NOT NULL default '',
764 -- Munged version of body text
765 si_text mediumtext
NOT NULL default '',
767 UNIQUE KEY (si_page
),
768 FULLTEXT
si_title (si_title
),
769 FULLTEXT
si_text (si_text
)
771 ) TYPE=MyISAM
, DEFAULT CHARSET
=utf8
;
774 -- Recognized interwiki link prefixes
776 CREATE TABLE /*$wgDBprefix*/interwiki (
777 -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
778 iw_prefix
char(32) NOT NULL,
780 -- The URL of the wiki, with "$1" as a placeholder for an article name.
781 -- Any spaces in the name will be transformed to underscores before
783 iw_url
char(127) NOT NULL,
785 -- A boolean value indicating whether the wiki is in this project
786 -- (used, for example, to detect redirect loops)
787 iw_local BOOL
NOT NULL,
789 -- Boolean value indicating whether interwiki transclusions are allowed.
790 iw_trans
TINYINT(1) NOT NULL DEFAULT 0,
792 UNIQUE KEY iw_prefix (iw_prefix
)
794 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
797 -- Used for caching expensive grouped queries
799 CREATE TABLE /*$wgDBprefix*/querycache (
800 -- A key name, generally the base name of of the special page.
801 qc_type
char(32) NOT NULL,
803 -- Some sort of stored value. Sizes, counts...
804 qc_value
int(5) unsigned
NOT NULL default '0',
806 -- Target namespace+title
807 qc_namespace
int NOT NULL default '0',
808 qc_title
char(255) binary NOT NULL default '',
810 KEY (qc_type
,qc_value
)
812 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
815 -- For a few generic cache operations if not using Memcached
817 CREATE TABLE /*$wgDBprefix*/objectcache (
818 keyname
char(255) binary not null default '',
821 unique key (keyname
),
824 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
826 -- For article validation
827 CREATE TABLE /*$wgDBprefix*/validate (
828 val_user
int(11) NOT NULL default '0',
829 val_page
int(11) unsigned
NOT NULL default '0',
830 val_revision
int(11) unsigned
NOT NULL default '0',
831 val_type
int(11) unsigned
NOT NULL default '0',
832 val_value
int(11) default '0',
833 val_comment
varchar(255) NOT NULL default '',
834 val_ip
varchar(20) NOT NULL default '',
835 KEY val_user (val_user
,val_revision
)
836 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
839 CREATE TABLE /*$wgDBprefix*/logging (
840 -- Symbolic keys for the general log type and the action type
841 -- within the log. The output format will be controlled by the
842 -- action field, but only the type controls categorization.
843 log_type
char(10) NOT NULL default '',
844 log_action
char(10) NOT NULL default '',
847 log_timestamp
char(14) NOT NULL default '19700101000000',
849 -- The user who performed this action; key to user_id
850 log_user
int unsigned
NOT NULL default 0,
852 -- Key to the page affected. Where a user is the target,
853 -- this will point to the user page.
854 log_namespace
int NOT NULL default 0,
855 log_title
varchar(255) binary NOT NULL default '',
857 -- Freeform text. Interpreted as edit history comments.
858 log_comment
varchar(255) NOT NULL default '',
860 -- LF separated list of miscellaneous parameters
861 log_params
blob NOT NULL default '',
863 KEY type_time (log_type
, log_timestamp
),
864 KEY user_time (log_user
, log_timestamp
),
865 KEY page_time (log_namespace
, log_title
, log_timestamp
)
867 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;
869 CREATE TABLE /*$wgDBprefix*/trackbacks (
870 tb_id
integer AUTO_INCREMENT
PRIMARY KEY,
871 tb_page
integer REFERENCES page(page_id
) ON DELETE CASCADE,
872 tb_title
varchar(255) NOT NULL,
873 tb_url
varchar(255) NOT NULL,
875 tb_name
varchar(255),
878 ) TYPE=InnoDB
, DEFAULT CHARSET
=utf8
;