c03a3b880da80ba0d9e661d007f924b33105a45c
[lhc/web/wiklou.git] / maintenance / tables.sql
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.
4
5 --
6 -- General notes:
7 --
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!)
11 --
12 -- Only the 'searchindex' table requires MyISAM due to the
13 -- requirement for fulltext index support, which is missing
14 -- from InnoDB.
15 --
16 --
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.
21 --
22 -- Historically TIMESTAMP fields were used, but abandoned
23 -- in early 2002 after a lot of trouble with the fields
24 -- auto-updating.
25 --
26 -- The PostgreSQL backend uses DATETIME fields for timestamps,
27 -- and we will migrate the MySQL definitions at some point as
28 -- well.
29 --
30 --
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.
36 --
37
38
39 --
40 -- The user table contains basic account information,
41 -- authentication keys, etc.
42 --
43 -- Some multi-wiki sites may share a single central user table
44 -- between separate wikis using the $wgSharedDB setting.
45 --
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
49 -- tables.
50 --
51 CREATE TABLE /*$wgDBprefix*/user (
52 user_id int(5) unsigned NOT NULL auto_increment,
53
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 '',
59
60 -- Optional 'real name' to be displayed in credit listings
61 user_real_name varchar(255) binary NOT NULL default '',
62
63 -- Password hashes, normally hashed like so:
64 -- MD5(CONCAT(user_id,'-',MD5(plaintext_password)))
65 user_password tinyblob NOT NULL default '',
66
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 '',
74
75 -- Note: email should be restricted, not public info.
76 -- Same with passwords.
77 user_email tinytext NOT NULL default '',
78
79 -- Newline-separated list of name=value pairs.
80 user_options blob NOT NULL default '',
81
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 '',
87
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 '',
93
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,
98
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,
102
103 -- Expiration date for the
104 user_email_token_expires CHAR(14) BINARY,
105
106 PRIMARY KEY user_id (user_id),
107 UNIQUE INDEX user_name (user_name),
108 INDEX (user_email_token)
109
110 ) TYPE=InnoDB;
111
112 --
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.
116 --
117 -- This table replaces the old user_rights field which used a
118 -- comma-separated blob.
119 --
120 CREATE TABLE /*$wgDBprefix*/user_groups (
121 -- Key to user_id
122 ug_user int(5) unsigned NOT NULL default '0',
123
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.
127 --
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 '',
133
134 PRIMARY KEY (ug_user,ug_group),
135 KEY (ug_group)
136 ) TYPE=InnoDB;
137
138 -- The following table is no longer needed with Enotif >= 2.00
139 -- Entries for newtalk on user_talk page are handled like in the watchlist table
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)
145 -- );
146
147
148 --
149 -- Core of the wiki: each page has an entry here which identifies
150 -- it by title and contains some essential metadata.
151 --
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,
156
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,
161
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,
165
166 -- Comma-separated set of permission keys indicating who
167 -- can move or edit the page.
168 page_restrictions tinyblob NOT NULL default '',
169
170 -- Number of times this page has been viewed.
171 page_counter bigint(20) unsigned NOT NULL default '0',
172
173 -- 1 indicates the article is a redirect.
174 page_is_redirect tinyint(1) unsigned NOT NULL default '0',
175
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',
179
180 -- Random value between 0 and 1, used for Special:Randompage
181 page_random real unsigned NOT NULL,
182
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 '',
189
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,
194
195 -- Uncompressed length in bytes of the page's current source text.
196 page_len int(8) unsigned NOT NULL,
197
198 PRIMARY KEY page_id (page_id),
199 UNIQUE INDEX name_title (page_namespace,page_title),
200
201 -- Special-purpose indexes
202 INDEX (page_random),
203 INDEX (page_len)
204
205 ) TYPE=InnoDB;
206
207 --
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.
211 --
212 CREATE TABLE /*$wgDBprefix*/revision (
213 rev_id int(8) unsigned NOT NULL auto_increment,
214
215 -- Key to page_id. This should _never_ be invalid.
216 rev_page int(8) unsigned NOT NULL,
217
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,
223
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 '',
228
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',
232
233 -- Text username or IP address of the editor.
234 rev_user_text varchar(255) binary NOT NULL default '',
235
236 -- Timestamp
237 rev_timestamp char(14) binary NOT NULL default '',
238
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',
242
243 -- Not yet used; reserved for future changes to the deletion system.
244 rev_deleted tinyint(1) unsigned NOT NULL default '0',
245
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)
252
253 ) TYPE=InnoDB;
254
255
256 --
257 -- Holds text of individual page revisions.
258 --
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.
263 --
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,
269
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 mediumtext NOT NULL default '',
273
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 '',
284
285 PRIMARY KEY old_id (old_id)
286
287 ) TYPE=InnoDB;
288
289 --
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.
294 --
295 CREATE TABLE /*$wgDBprefix*/archive (
296 ar_namespace int NOT NULL default '0',
297 ar_title varchar(255) binary NOT NULL default '',
298
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 ar_text mediumtext NOT NULL default '',
305
306 -- Basic revision stuff...
307 ar_comment tinyblob NOT NULL default '',
308 ar_user int(5) unsigned NOT NULL default '0',
309 ar_user_text varchar(255) binary NOT NULL,
310 ar_timestamp char(14) binary NOT NULL default '',
311 ar_minor_edit tinyint(1) NOT NULL default '0',
312
313 -- See ar_text note.
314 ar_flags tinyblob NOT NULL default '',
315
316 -- When revisions are deleted, their unique rev_id is stored
317 -- here so it can be retained after undeletion. This is necessary
318 -- to retain permalinks to given revisions after accidental delete
319 -- cycles or messy operations like history merges.
320 --
321 -- Old entries from 1.4 will be NULL here, and a new rev_id will
322 -- be created on undeletion for those revisions.
323 ar_rev_id int(8) unsigned,
324
325 -- For newly deleted revisions, this is the text.old_id key to the
326 -- actual stored text. To avoid breaking the block-compression scheme
327 -- and otherwise making storage changes harder, the actual text is
328 -- *not* deleted from the text table, merely hidden by removal of the
329 -- page and revision entries.
330 --
331 -- Old entries deleted under 1.2-1.4 will have NULL here, and their
332 -- ar_text and ar_flags fields will be used to create a new text
333 -- row upon undeletion.
334 ar_text_id int(8) unsigned,
335
336 KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
337
338 ) TYPE=InnoDB;
339
340
341 --
342 -- Track page-to-page hyperlinks within the wiki.
343 --
344 CREATE TABLE /*$wgDBprefix*/pagelinks (
345 -- Key to the page_id of the page containing the link.
346 pl_from int(8) unsigned NOT NULL default '0',
347
348 -- Key to page_namespace/page_title of the target page.
349 -- The target page may or may not exist, and due to renames
350 -- and deletions may refer to different page records as time
351 -- goes by.
352 pl_namespace int NOT NULL default '0',
353 pl_title varchar(255) binary NOT NULL default '',
354
355 UNIQUE KEY pl_from(pl_from,pl_namespace,pl_title),
356 KEY (pl_namespace,pl_title)
357
358 ) TYPE=InnoDB;
359
360
361 --
362 -- Track links to images *used inline*
363 -- We don't distinguish live from broken links here, so
364 -- they do not need to be changed on upload/removal.
365 --
366 CREATE TABLE /*$wgDBprefix*/imagelinks (
367 -- Key to page_id of the page containing the image / media link.
368 il_from int(8) unsigned NOT NULL default '0',
369
370 -- Filename of target image.
371 -- This is also the page_title of the file's description page;
372 -- all such pages are in namespace 6 (NS_IMAGE).
373 il_to varchar(255) binary NOT NULL default '',
374
375 UNIQUE KEY il_from(il_from,il_to),
376 KEY (il_to)
377
378 ) TYPE=InnoDB;
379
380 --
381 -- Track category inclusions *used inline*
382 -- This tracks a single level of category membership
383 -- (folksonomic tagging, really).
384 --
385 CREATE TABLE /*$wgDBprefix*/categorylinks (
386 -- Key to page_id of the page defined as a category member.
387 cl_from int(8) unsigned NOT NULL default '0',
388
389 -- Name of the category.
390 -- This is also the page_title of the category's description page;
391 -- all such pages are in namespace 14 (NS_CATEGORY).
392 cl_to varchar(255) binary NOT NULL default '',
393
394 -- The title of the linking page, or an optional override
395 -- to determine sort order. Sorting is by binary order, which
396 -- isn't always ideal, but collations seem to be an exciting
397 -- and dangerous new world in MySQL...
398 --
399 -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
400 -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
401 -- To sort properly on the shorter key, this field needs to be
402 -- the same shortness.
403 cl_sortkey varchar(86) binary NOT NULL default '',
404
405 -- This isn't really used at present. Provided for an optional
406 -- sorting method by approximate addition time.
407 cl_timestamp timestamp NOT NULL,
408
409 UNIQUE KEY cl_from(cl_from,cl_to),
410
411 -- We always sort within a given category...
412 KEY cl_sortkey(cl_to,cl_sortkey),
413
414 -- Not really used?
415 KEY cl_timestamp(cl_to,cl_timestamp)
416
417 ) TYPE=InnoDB;
418
419 --
420 -- Contains a single row with some aggregate info
421 -- on the state of the site.
422 --
423 CREATE TABLE /*$wgDBprefix*/site_stats (
424 -- The single row should contain 1 here.
425 ss_row_id int(8) unsigned NOT NULL,
426
427 -- Total number of page views, if hit counters are enabled.
428 ss_total_views bigint(20) unsigned default '0',
429
430 -- Total number of edits performed.
431 ss_total_edits bigint(20) unsigned default '0',
432
433 -- An approximate count of pages matching the following criteria:
434 -- * in namespace 0
435 -- * not a redirect
436 -- * contains the text '[['
437 -- See isCountable() in includes/Article.php
438 ss_good_articles bigint(20) unsigned default '0',
439
440 UNIQUE KEY ss_row_id (ss_row_id)
441
442 ) TYPE=InnoDB;
443
444 --
445 -- Stores an ID for every time any article is visited;
446 -- depending on $wgHitcounterUpdateFreq, it is
447 -- periodically cleared and the cur_counter column
448 -- in the cur table updated for the all articles
449 -- that have been visited.)
450 --
451 CREATE TABLE /*$wgDBprefix*/hitcounter (
452 hc_id INTEGER UNSIGNED NOT NULL
453 ) TYPE=HEAP MAX_ROWS=25000;
454
455
456 --
457 -- The internet is full of jerks, alas. Sometimes it's handy
458 -- to block a vandal or troll account.
459 --
460 CREATE TABLE /*$wgDBprefix*/ipblocks (
461 -- Primary key, introduced for privacy.
462 ipb_id int(8) NOT NULL auto_increment,
463
464 -- Blocked IP address in dotted-quad form or user name.
465 ipb_address varchar(40) binary NOT NULL default '',
466
467 -- Blocked user ID or 0 for IP blocks.
468 ipb_user int(8) unsigned NOT NULL default '0',
469
470 -- User ID who made the block.
471 ipb_by int(8) unsigned NOT NULL default '0',
472
473 -- Text comment made by blocker.
474 ipb_reason tinyblob NOT NULL default '',
475
476 -- Creation (or refresh) date in standard YMDHMS form.
477 -- IP blocks expire automatically.
478 ipb_timestamp char(14) binary NOT NULL default '',
479
480 -- Indicates that the IP address was banned because a banned
481 -- user accessed a page through it. If this is 1, ipb_address
482 -- will be hidden, and the block identified by block ID number.
483 ipb_auto tinyint(1) NOT NULL default '0',
484
485 -- Time at which the block will expire.
486 ipb_expiry char(14) binary NOT NULL default '',
487
488 PRIMARY KEY ipb_id (ipb_id),
489 INDEX ipb_address (ipb_address),
490 INDEX ipb_user (ipb_user)
491
492 ) TYPE=InnoDB;
493
494
495 --
496 -- Uploaded images and other files.
497 --
498 CREATE TABLE /*$wgDBprefix*/image (
499 -- Filename.
500 -- This is also the title of the associated description page,
501 -- which will be in namespace 6 (NS_IMAGE).
502 img_name varchar(255) binary NOT NULL default '',
503
504 -- File size in bytes.
505 img_size int(8) unsigned NOT NULL default '0',
506
507 -- For images, size in pixels.
508 img_width int(5) NOT NULL default '0',
509 img_height int(5) NOT NULL default '0',
510
511 -- Extracted EXIF metadata stored as a serialized PHP array.
512 img_metadata mediumblob NOT NULL,
513
514 -- For images, bits per pixel if known.
515 img_bits int(3) NOT NULL default '0',
516
517 -- Media type as defined by the MEDIATYPE_xxx constants
518 img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
519
520 -- major part of a MIME media type as defined by IANA
521 -- see http://www.iana.org/assignments/media-types/
522 img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
523
524 -- minor part of a MIME media type as defined by IANA
525 -- the minor parts are not required to adher to any standard
526 -- but should be consistent throughout the database
527 -- see http://www.iana.org/assignments/media-types/
528 img_minor_mime varchar(32) NOT NULL default "unknown",
529
530 -- Description field as entered by the uploader.
531 -- This is displayed in image upload history and logs.
532 img_description tinyblob NOT NULL default '',
533
534 -- user_id and user_name of uploader.
535 img_user int(5) unsigned NOT NULL default '0',
536 img_user_text varchar(255) binary NOT NULL default '',
537
538 -- Time of the upload.
539 img_timestamp char(14) binary NOT NULL default '',
540
541 PRIMARY KEY img_name (img_name),
542
543 -- Used by Special:Imagelist for sort-by-size
544 INDEX img_size (img_size),
545
546 -- Used by Special:Newimages and Special:Imagelist
547 INDEX img_timestamp (img_timestamp)
548
549 ) TYPE=InnoDB;
550
551 --
552 -- Previous revisions of uploaded files.
553 -- Awkwardly, image rows have to be moved into
554 -- this table at re-upload time.
555 --
556 CREATE TABLE /*$wgDBprefix*/oldimage (
557 -- Base filename: key to image.img_name
558 oi_name varchar(255) binary NOT NULL default '',
559
560 -- Filename of the archived file.
561 -- This is generally a timestamp and '!' prepended to the base name.
562 oi_archive_name varchar(255) binary NOT NULL default '',
563
564 -- Other fields as in image...
565 oi_size int(8) unsigned NOT NULL default 0,
566 oi_width int(5) NOT NULL default 0,
567 oi_height int(5) NOT NULL default 0,
568 oi_bits int(3) NOT NULL default 0,
569 oi_description tinyblob NOT NULL default '',
570 oi_user int(5) unsigned NOT NULL default '0',
571 oi_user_text varchar(255) binary NOT NULL default '',
572 oi_timestamp char(14) binary NOT NULL default '',
573
574 INDEX oi_name (oi_name(10))
575
576 ) TYPE=InnoDB;
577
578
579 --
580 -- Primarily a summary table for Special:Recentchanges,
581 -- this table contains some additional info on edits from
582 -- the last few days.
583 --
584 CREATE TABLE /*$wgDBprefix*/recentchanges (
585 rc_id int(8) NOT NULL auto_increment,
586 rc_timestamp varchar(14) binary NOT NULL default '',
587 rc_cur_time varchar(14) binary NOT NULL default '',
588
589 -- As in revision
590 rc_user int(10) unsigned NOT NULL default '0',
591 rc_user_text varchar(255) binary NOT NULL default '',
592
593 -- When pages are renamed, their RC entries do _not_ change.
594 rc_namespace int NOT NULL default '0',
595 rc_title varchar(255) binary NOT NULL default '',
596
597 -- as in revision...
598 rc_comment varchar(255) binary NOT NULL default '',
599 rc_minor tinyint(3) unsigned NOT NULL default '0',
600
601 -- Edits by user accounts with the 'bot' rights key are
602 -- marked with a 1 here, and will be hidden from the
603 -- default view.
604 rc_bot tinyint(3) unsigned NOT NULL default '0',
605
606 rc_new tinyint(3) unsigned NOT NULL default '0',
607
608 -- Key to page_id (was cur_id prior to 1.5).
609 -- This will keep links working after moves while
610 -- retaining the at-the-time name in the changes list.
611 rc_cur_id int(10) unsigned NOT NULL default '0',
612
613 -- rev_id of the given revision
614 rc_this_oldid int(10) unsigned NOT NULL default '0',
615
616 -- rev_id of the prior revision, for generating diff links.
617 rc_last_oldid int(10) unsigned NOT NULL default '0',
618
619 -- These may no longer be used, with the new move log.
620 rc_type tinyint(3) unsigned NOT NULL default '0',
621 rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
622 rc_moved_to_title varchar(255) binary NOT NULL default '',
623
624 -- If the Recent Changes Patrol option is enabled,
625 -- users may mark edits as having been reviewed to
626 -- remove a warning flag on the RC list.
627 -- A value of 1 indicates the page has been reviewed.
628 rc_patrolled tinyint(3) unsigned NOT NULL default '0',
629
630 -- Recorded IP address the edit was made from, if the
631 -- $wgPutIPinRC option is enabled.
632 rc_ip char(15) NOT NULL default '',
633
634 PRIMARY KEY rc_id (rc_id),
635 INDEX rc_timestamp (rc_timestamp),
636 INDEX rc_namespace_title (rc_namespace, rc_title),
637 INDEX rc_cur_id (rc_cur_id),
638 INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp),
639 INDEX rc_ip (rc_ip)
640
641 ) TYPE=InnoDB;
642
643 CREATE TABLE /*$wgDBprefix*/watchlist (
644 -- Key to user_id
645 wl_user int(5) unsigned NOT NULL,
646
647 -- Key to page_namespace/page_title
648 -- Note that users may watch patches which do not exist yet,
649 -- or existed in the past but have been deleted.
650 wl_namespace int NOT NULL default '0',
651 wl_title varchar(255) binary NOT NULL default '',
652
653 -- Timestamp when user was last sent a notification e-mail;
654 -- cleared when the user visits the page.
655 -- FIXME: add proper null support etc
656 wl_notificationtimestamp varchar(14) binary NOT NULL default '0',
657
658 UNIQUE KEY (wl_user, wl_namespace, wl_title),
659 KEY namespace_title (wl_namespace,wl_title)
660
661 ) TYPE=InnoDB;
662
663
664 --
665 -- Used by texvc math-rendering extension to keep track
666 -- of previously-rendered items.
667 --
668 CREATE TABLE /*$wgDBprefix*/math (
669 -- Binary MD5 hash of the latex fragment, used as an identifier key.
670 math_inputhash varchar(16) NOT NULL,
671
672 -- Not sure what this is, exactly...
673 math_outputhash varchar(16) NOT NULL,
674
675 -- texvc reports how well it thinks the HTML conversion worked;
676 -- if it's a low level the PNG rendering may be preferred.
677 math_html_conservativeness tinyint(1) NOT NULL,
678
679 -- HTML output from texvc, if any
680 math_html text,
681
682 -- MathML output from texvc, if any
683 math_mathml text,
684
685 UNIQUE KEY math_inputhash (math_inputhash)
686
687 ) TYPE=InnoDB;
688
689 --
690 -- When using the default MySQL search backend, page titles
691 -- and text are munged to strip markup, do Unicode case folding,
692 -- and prepare the result for MySQL's fulltext index.
693 --
694 -- This table must be MyISAM; InnoDB does not support the needed
695 -- fulltext index.
696 --
697 CREATE TABLE /*$wgDBprefix*/searchindex (
698 -- Key to page_id
699 si_page int(8) unsigned NOT NULL,
700
701 -- Munged version of title
702 si_title varchar(255) NOT NULL default '',
703
704 -- Munged version of body text
705 si_text mediumtext NOT NULL default '',
706
707 UNIQUE KEY (si_page),
708 FULLTEXT si_title (si_title),
709 FULLTEXT si_text (si_text)
710
711 ) TYPE=MyISAM;
712
713 --
714 -- Recognized interwiki link prefixes
715 --
716 CREATE TABLE /*$wgDBprefix*/interwiki (
717 -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
718 iw_prefix char(32) NOT NULL,
719
720 -- The URL of the wiki, with "$1" as a placeholder for an article name.
721 -- Any spaces in the name will be transformed to underscores before
722 -- insertion.
723 iw_url char(127) NOT NULL,
724
725 -- A boolean value indicating whether the wiki is in this project
726 -- (used, for example, to detect redirect loops)
727 iw_local BOOL NOT NULL,
728
729 UNIQUE KEY iw_prefix (iw_prefix)
730
731 ) TYPE=InnoDB;
732
733 --
734 -- Used for caching expensive grouped queries
735 --
736 CREATE TABLE /*$wgDBprefix*/querycache (
737 -- A key name, generally the base name of of the special page.
738 qc_type char(32) NOT NULL,
739
740 -- Some sort of stored value. Sizes, counts...
741 qc_value int(5) unsigned NOT NULL default '0',
742
743 -- Target namespace+title
744 qc_namespace int NOT NULL default '0',
745 qc_title char(255) binary NOT NULL default '',
746
747 KEY (qc_type,qc_value)
748
749 ) TYPE=InnoDB;
750
751 --
752 -- For a few generic cache operations if not using Memcached
753 --
754 CREATE TABLE /*$wgDBprefix*/objectcache (
755 keyname char(255) binary not null default '',
756 value mediumblob,
757 exptime datetime,
758 unique key (keyname),
759 key (exptime)
760
761 ) TYPE=InnoDB;
762
763 -- For article validation
764 CREATE TABLE /*$wgDBprefix*/validate (
765 `val_user` int(11) NOT NULL default '0',
766 `val_page` int(11) unsigned NOT NULL default '0',
767 `val_revision` int(11) unsigned NOT NULL default '0',
768 `val_type` int(11) unsigned NOT NULL default '0',
769 `val_value` int(11) default '0',
770 `val_comment` varchar(255) NOT NULL default '',
771 KEY `val_user` (`val_user`,`val_revision`)
772 ) TYPE=InnoDB;
773
774
775 CREATE TABLE /*$wgDBprefix*/logging (
776 -- Symbolic keys for the general log type and the action type
777 -- within the log. The output format will be controlled by the
778 -- action field, but only the type controls categorization.
779 log_type char(10) NOT NULL default '',
780 log_action char(10) NOT NULL default '',
781
782 -- Timestamp. Duh.
783 log_timestamp char(14) NOT NULL default '19700101000000',
784
785 -- The user who performed this action; key to user_id
786 log_user int unsigned NOT NULL default 0,
787
788 -- Key to the page affected. Where a user is the target,
789 -- this will point to the user page.
790 log_namespace int NOT NULL default 0,
791 log_title varchar(255) binary NOT NULL default '',
792
793 -- Freeform text. Interpreted as edit history comments.
794 log_comment varchar(255) NOT NULL default '',
795
796 -- LF separated list of miscellaneous parameters
797 log_params blob NOT NULL default '',
798
799 KEY type_time (log_type, log_timestamp),
800 KEY user_time (log_user, log_timestamp),
801 KEY page_time (log_namespace, log_title, log_timestamp)
802
803 ) TYPE=InnoDB;
804
805
806
807
808
809 -- Hold group name and description
810 --CREATE TABLE /*$wgDBprefix*/groups (
811 -- gr_id int(5) unsigned NOT NULL auto_increment,
812 -- gr_name varchar(50) NOT NULL default '',
813 -- gr_description varchar(255) NOT NULL default '',
814 -- gr_rights tinyblob,
815 -- PRIMARY KEY (gr_id)
816 --
817 --) TYPE=InnoDB;