Move schema documentation to inline comments in tables.sql,
[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 INDEX user_name (user_name(10)),
108 INDEX (user_email_token)
109 );
110
111 --
112 -- User permissions have been broken out to a separate table;
113 -- this allows sites with a shared user table to have different
114 -- permissions assigned to a user in each project.
115 --
116 -- TODO: de-blob this; it should be a property table
117 --
118 CREATE TABLE /*$wgDBprefix*/user_rights (
119 -- Key to user_id
120 ur_user int(5) unsigned NOT NULL,
121
122 -- Comma-separated list of permission keys
123 ur_rights tinyblob NOT NULL default '',
124
125 UNIQUE KEY ur_user (ur_user)
126 );
127
128 -- The following table is no longer needed with Enotif >= 2.00
129 -- Entries for newtalk on user_talk page are handled like in the watchlist table
130 -- CREATE TABLE /*$wgDBprefix*/user_newtalk (
131 -- user_id int(5) NOT NULL default '0',
132 -- user_ip varchar(40) NOT NULL default '',
133 -- INDEX user_id (user_id),
134 -- INDEX user_ip (user_ip)
135 -- );
136
137
138 --
139 -- Core of the wiki: each page has an entry here which identifies
140 -- it by title and contains some essential metadata.
141 --
142 CREATE TABLE /*$wgDBprefix*/page (
143 -- Unique identifier number. The page_id will be preserved across
144 -- edits and rename operations, but not deletions and recreations.
145 page_id int(8) unsigned NOT NULL auto_increment,
146
147 -- A page name is broken into a namespace and a title.
148 -- The namespace keys are UI-language-independent constants,
149 -- defined in Namespace.php.
150 page_namespace tinyint NOT NULL,
151
152 -- The rest of the title, as text.
153 -- Spaces are transformed into underscores in title storage.
154 page_title varchar(255) binary NOT NULL,
155
156 -- Comma-separated set of permission keys indicating who
157 -- can move or edit the page.
158 page_restrictions tinyblob NOT NULL default '',
159
160 -- Number of times this page has been viewed.
161 page_counter bigint(20) unsigned NOT NULL default '0',
162
163 -- 1 indicates the article is a redirect.
164 page_is_redirect tinyint(1) unsigned NOT NULL default '0',
165
166 -- 1 indicates this is a new entry, with only one edit.
167 -- Not all pages with one edit are new pages.
168 page_is_new tinyint(1) unsigned NOT NULL default '0',
169
170 -- Random value between 0 and 1, used for Special:Randompage
171 page_random real unsigned NOT NULL,
172
173 -- This timestamp is updated whenever the page changes in
174 -- a way requiring it to be re-rendered, invalidating caches.
175 -- On top of editing this includes permission changes,
176 -- creation or deletion of linked pages, and alteration
177 -- of contained templates.
178 page_touched char(14) binary NOT NULL default '',
179
180
181 -- Handy key to revision.rev_id of the current revision.
182 -- This may be 0 during page creation, but that shouldn't
183 -- happen outside of a transaction... hopefully.
184 page_latest int(8) unsigned NOT NULL,
185
186 -- Uncompressed length in bytes of the page's current source text.
187 page_len int(8) unsigned NOT NULL,
188
189 PRIMARY KEY page_id (page_id),
190 UNIQUE INDEX name_title (page_namespace,page_title),
191
192 -- Special-purpose indexes
193 INDEX (page_random),
194 INDEX (page_len)
195 );
196
197 --
198 -- Every edit of a page creates also a revision row.
199 -- This stores metadata about the revision, and a reference
200 -- to the text storage backend.
201 --
202 CREATE TABLE /*$wgDBprefix*/revision (
203 rev_id int(8) unsigned NOT NULL auto_increment,
204
205 -- Key to page_id. This should _never_ be invalid.
206 rev_page int(8) unsigned NOT NULL,
207
208 -- Key to text.old_id, where the actual bulk text is stored.
209 -- It's possible for multiple revisions to use the same text,
210 -- for instance revisions where only metadata is altered
211 -- or a rollback to a previous version.
212 rev_text_id int(8) unsigned NOT NULL,
213
214 -- Text comment summarizing the change.
215 -- This text is shown in the history and other changes lists,
216 -- rendered in a subset of wiki markup.
217 rev_comment tinyblob NOT NULL default '',
218
219 -- Key to user_id of the user who made this edit.
220 -- Stores 0 for anonymous edits and for some mass imports.
221 rev_user int(5) unsigned NOT NULL default '0',
222
223 -- Text username or IP address of the editor.
224 rev_user_text varchar(255) binary NOT NULL default '',
225
226 -- Timestamp
227 rev_timestamp char(14) binary NOT NULL default '',
228
229 -- Records whether the user marked the 'minor edit' checkbox.
230 -- Many automated edits are marked as minor.
231 rev_minor_edit tinyint(1) unsigned NOT NULL default '0',
232
233 -- Not yet used; reserved for future changes to the deletion system.
234 rev_deleted tinyint(1) unsigned NOT NULL default '0',
235
236 PRIMARY KEY rev_page_id (rev_page, rev_id),
237 UNIQUE INDEX rev_id (rev_id),
238 INDEX rev_timestamp (rev_timestamp),
239 INDEX page_timestamp (rev_page,rev_timestamp),
240 INDEX user_timestamp (rev_user,rev_timestamp),
241 INDEX usertext_timestamp (rev_user_text,rev_timestamp)
242 );
243
244
245 --
246 -- Holds text of individual page revisions.
247 --
248 -- Field names are a holdover from the 'old' revisions table in
249 -- MediaWiki 1.4 and earlier: an upgrade will transform that
250 -- table into the 'text' table to minimize unnecessary churning
251 -- and downtime. If upgrading, the other fields will be left unused.
252 --
253 CREATE TABLE /*$wgDBprefix*/text (
254 -- Unique text storage key number.
255 -- Note that the 'oldid' parameter used in URLs does *not*
256 -- refer to this number anymore, but to rev_id.
257 old_id int(8) unsigned NOT NULL auto_increment,
258
259 -- Depending on the contents of the old_flags field, the text
260 -- may be convenient plain text, or it may be funkily encoded.
261 old_text mediumtext NOT NULL default '',
262
263 -- Comma-separated list of flags:
264 -- gzip: text is compressed with PHP's gzdeflate() function.
265 -- utf8: text was stored as UTF-8.
266 -- If $wgLegacyEncoding option is on, rows *without* this flag
267 -- will be converted to UTF-8 transparently at load time.
268 -- object: text field contained a serialized PHP object.
269 -- The object either contains multiple versions compressed
270 -- together to achieve a better compression ratio, or it refers
271 -- to another row where the text can be found.
272 old_flags tinyblob NOT NULL default '',
273
274 PRIMARY KEY old_id (old_id)
275 );
276
277 --
278 -- Holding area for deleted articles, which may be viewed
279 -- or restored by admins through the Special:Undelete interface.
280 -- The fields generally correspond to the page, revision, and text
281 -- fields, with several caveats.
282 --
283 CREATE TABLE /*$wgDBprefix*/archive (
284 ar_namespace tinyint(2) unsigned NOT NULL default '0',
285 ar_title varchar(255) binary NOT NULL default '',
286
287 -- Newly deleted pages will not store text in this table,
288 -- but will reference the separately existing text rows.
289 -- This field is retained for backwards compatibility,
290 -- so old archived pages will remain accessible after
291 -- upgrading from 1.4 to 1.5.
292 ar_text mediumtext NOT NULL default '',
293
294 -- Basic revision stuff...
295 ar_comment tinyblob NOT NULL default '',
296 ar_user int(5) unsigned NOT NULL default '0',
297 ar_user_text varchar(255) binary NOT NULL,
298 ar_timestamp char(14) binary NOT NULL default '',
299 ar_minor_edit tinyint(1) NOT NULL default '0',
300
301 -- See ar_text note.
302 ar_flags tinyblob NOT NULL default '',
303
304 -- When revisions are deleted, their unique rev_id is stored
305 -- here so it can be retained after undeletion. This is necessary
306 -- to retain permalinks to given revisions after accidental delete
307 -- cycles or messy operations like history merges.
308 --
309 -- Old entries from 1.4 will be NULL here, and a new rev_id will
310 -- be created on undeletion for those revisions.
311 ar_rev_id int(8) unsigned,
312
313 -- For newly deleted revisions, this is the text.old_id key to the
314 -- actual stored text. To avoid breaking the block-compression scheme
315 -- and otherwise making storage changes harder, the actual text is
316 -- *not* deleted from the text table, merely hidden by removal of the
317 -- page and revision entries.
318 --
319 -- Old entries deleted under 1.2-1.4 will have NULL here, and their
320 -- ar_text and ar_flags fields will be used to create a new text
321 -- row upon undeletion.
322 ar_text_id int(8) unsigned,
323
324 KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp)
325 );
326
327 --
328 -- Track links within the wiki that do exist.
329 -- These rows must be removed when the target page is
330 -- deleted, and replaced with brokenlinks entries.
331 -- They must also be updated if a target page is renamed.
332 --
333 CREATE TABLE /*$wgDBprefix*/links (
334 -- Key to the page_id of the page containing the link.
335 l_from int(8) unsigned NOT NULL default '0',
336
337 -- Key to the page_id of the link target.
338 -- An unfortunate consequence of this is that rename
339 -- operations require changing the links entries for
340 -- all links to the moved page.
341 l_to int(8) unsigned NOT NULL default '0',
342
343 UNIQUE KEY l_from(l_from,l_to),
344 KEY (l_to)
345 );
346
347 --
348 -- Track links to pages that don't yet exist.
349 -- These rows must be removed when the target page
350 -- is created, and replaced with links table entries.
351 --
352 CREATE TABLE /*$wgDBprefix*/brokenlinks (
353 -- Key to the page_id of the page containing the link.
354 bl_from int(8) unsigned NOT NULL default '0',
355
356 -- Text of the target page title ("namesapce:title").
357 -- Unfortunately this doesn't split the namespace index
358 -- key and therefore can't easily be joined to anything.
359 bl_to varchar(255) binary NOT NULL default '',
360 UNIQUE KEY bl_from(bl_from,bl_to),
361 KEY (bl_to)
362 );
363
364 --
365 -- Track links to images *used inline*
366 -- We don't distinguish live from broken links here, so
367 -- they do not need to be changed on upload/removal.
368 --
369 CREATE TABLE /*$wgDBprefix*/imagelinks (
370 -- Key to page_id of the page containing the image / media link.
371 il_from int(8) unsigned NOT NULL default '0',
372
373 -- Filename of target image.
374 -- This is also the page_title of the file's description page;
375 -- all such pages are in namespace 6 (NS_IMAGE).
376 il_to varchar(255) binary NOT NULL default '',
377
378 UNIQUE KEY il_from(il_from,il_to),
379 KEY (il_to)
380 );
381
382 --
383 -- Track category inclusions *used inline*
384 -- This tracks a single level of category membership
385 -- (folksonomic tagging, really).
386 --
387 CREATE TABLE /*$wgDBprefix*/categorylinks (
388 -- Key to page_id of the page defined as a category member.
389 cl_from int(8) unsigned NOT NULL default '0',
390
391 -- Name of the category.
392 -- This is also the page_title of the category's description page;
393 -- all such pages are in namespace 14 (NS_CATEGORY).
394 cl_to varchar(255) binary NOT NULL default '',
395
396 -- The title of the linking page, or an optional override
397 -- to determine sort order. Sorting is by binary order, which
398 -- isn't always ideal, but collations seem to be an exciting
399 -- and dangerous new world in MySQL...
400 cl_sortkey varchar(255) binary NOT NULL default '',
401
402 -- This isn't really used at present. Provided for an optional
403 -- sorting method by approximate addition time.
404 cl_timestamp timestamp NOT NULL,
405
406 UNIQUE KEY cl_from(cl_from,cl_to),
407
408 -- This key is trouble. It's incomplete, AND it's too big
409 -- when collation is set to UTF-8. Bleeeacch!
410 KEY cl_sortkey(cl_to,cl_sortkey(128)),
411
412 -- Not really used?
413 KEY cl_timestamp(cl_to,cl_timestamp)
414 );
415
416 --
417 -- Stores (possibly gzipped) serialized objects with
418 -- cache arrays to reduce database load slurping up
419 -- from links and brokenlinks.
420 --
421 CREATE TABLE /*$wgDBprefix*/linkscc (
422 lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
423 lcc_cacheobj MEDIUMBLOB NOT NULL
424 );
425
426 --
427 -- Contains a single row with some aggregate info
428 -- on the state of the site.
429 --
430 CREATE TABLE /*$wgDBprefix*/site_stats (
431 -- The single row should contain 1 here.
432 ss_row_id int(8) unsigned NOT NULL,
433
434 -- Total number of page views, if hit counters are enabled.
435 ss_total_views bigint(20) unsigned default '0',
436
437 -- Total number of edits performed.
438 ss_total_edits bigint(20) unsigned default '0',
439
440 -- An approximate count of pages matching the following criteria:
441 -- * in namespace 0
442 -- * not a redirect
443 -- * contains the text '[['
444 ss_good_articles bigint(20) unsigned default '0',
445
446 UNIQUE KEY ss_row_id (ss_row_id)
447 );
448
449 --
450 -- Stores an ID for every time any article is visited;
451 -- depending on $wgHitcounterUpdateFreq, it is
452 -- periodically cleared and the cur_counter column
453 -- in the cur table updated for the all articles
454 -- that have been visited.)
455 --
456 CREATE TABLE /*$wgDBprefix*/hitcounter (
457 hc_id INTEGER UNSIGNED NOT NULL
458 ) TYPE=HEAP MAX_ROWS=25000;
459
460
461 --
462 -- The internet is full of jerks, alas. Sometimes it's handy
463 -- to block a vandal or troll account.
464 --
465 CREATE TABLE /*$wgDBprefix*/ipblocks (
466 -- Primary key, introduced for privacy.
467 ipb_id int(8) NOT NULL auto_increment,
468
469 -- Blocked IP address in dotted-quad form or user name.
470 ipb_address varchar(40) binary NOT NULL default '',
471
472 -- Blocked user ID or 0 for IP blocks.
473 ipb_user int(8) unsigned NOT NULL default '0',
474
475 -- User ID who made the block.
476 ipb_by int(8) unsigned NOT NULL default '0',
477
478 -- Text comment made by blocker.
479 ipb_reason tinyblob NOT NULL default '',
480
481 -- Creation (or refresh) date in standard YMDHMS form.
482 -- IP blocks expire automatically.
483 ipb_timestamp char(14) binary NOT NULL default '',
484
485 -- Indicates that the IP address was banned because a banned
486 -- user accessed a page through it. If this is 1, ipb_address
487 -- will be hidden, and the block identified by block ID number.
488 ipb_auto tinyint(1) NOT NULL default '0',
489
490 -- Time at which the block will expire.
491 ipb_expiry char(14) binary NOT NULL default '',
492
493 PRIMARY KEY ipb_id (ipb_id),
494 INDEX ipb_address (ipb_address),
495 INDEX ipb_user (ipb_user)
496 );
497
498
499 --
500 -- Uploaded images and other files.
501 --
502 CREATE TABLE /*$wgDBprefix*/image (
503 -- Filename.
504 -- This is also the title of the associated description page,
505 -- which will be in namespace 6 (NS_IMAGE).
506 img_name varchar(255) binary NOT NULL default '',
507
508 -- File size in bytes.
509 img_size int(8) unsigned NOT NULL default '0',
510
511 -- For images, size in pixels.
512 img_width int(5) NOT NULL default '0',
513 img_height int(5) NOT NULL default '0',
514
515 -- Extracted EXIF metadata stored as a serialized PHP array.
516 img_metadata mediumblob NOT NULL,
517
518 -- For images, bits per pixel if known.
519 img_bits int(3) NOT NULL default '0',
520
521 -- File type key returned by getimagesize().
522 -- See http://www.php.net/getimagesize for possible values.
523 img_type int(3) NOT NULL default '0',
524
525 -- Description field as entered by the uploader.
526 -- This is displayed in image upload history and logs.
527 img_description tinyblob NOT NULL default '',
528
529 -- user_id and user_name of uploader.
530 img_user int(5) unsigned NOT NULL default '0',
531 img_user_text varchar(255) binary NOT NULL default '',
532
533 -- Time of the upload.
534 img_timestamp char(14) binary NOT NULL default '',
535
536 PRIMARY KEY img_name (img_name),
537
538 -- Used by Special:Imagelist for sort-by-size
539 INDEX img_size (img_size),
540
541 -- Used by Special:Newimages and Special:Imagelist
542 INDEX img_timestamp (img_timestamp)
543 );
544
545 --
546 -- Previous revisions of uploaded files.
547 -- Awkwardly, image rows have to be moved into
548 -- this table at re-upload time.
549 --
550 CREATE TABLE /*$wgDBprefix*/oldimage (
551 -- Base filename: key to image.img_name
552 oi_name varchar(255) binary NOT NULL default '',
553
554 -- Filename of the archived file.
555 -- This is generally a timestamp and '!' prepended to the base name.
556 oi_archive_name varchar(255) binary NOT NULL default '',
557
558 -- Other fields as in image...
559 oi_size int(8) unsigned NOT NULL default 0,
560 oi_width int(5) NOT NULL default 0,
561 oi_height int(5) NOT NULL default 0,
562 oi_bits int(3) NOT NULL default 0,
563 oi_type int(3) NOT NULL default 0,
564 oi_description tinyblob NOT NULL default '',
565 oi_user int(5) unsigned NOT NULL default '0',
566 oi_user_text varchar(255) binary NOT NULL default '',
567 oi_timestamp char(14) binary NOT NULL default '',
568
569 INDEX oi_name (oi_name(10))
570 );
571
572
573 --
574 -- Primarily a summary table for Special:Recentchanges,
575 -- this table contains some additional info on edits from
576 -- the last few days.
577 --
578 CREATE TABLE /*$wgDBprefix*/recentchanges (
579 rc_id int(8) NOT NULL auto_increment,
580 rc_timestamp varchar(14) binary NOT NULL default '',
581 rc_cur_time varchar(14) binary NOT NULL default '',
582
583 -- As in revision
584 rc_user int(10) unsigned NOT NULL default '0',
585 rc_user_text varchar(255) binary NOT NULL default '',
586
587 -- When pages are renamed, their RC entries do _not_ change.
588 rc_namespace tinyint(3) NOT NULL default '0',
589 rc_title varchar(255) binary NOT NULL default '',
590
591 -- as in revision...
592 rc_comment varchar(255) binary NOT NULL default '',
593 rc_minor tinyint(3) unsigned NOT NULL default '0',
594
595 -- Edits by user accounts with the 'bot' rights key are
596 -- marked with a 1 here, and will be hidden from the
597 -- default view.
598 rc_bot tinyint(3) unsigned NOT NULL default '0',
599
600 rc_new tinyint(3) unsigned NOT NULL default '0',
601
602 -- Key to page_id (was cur_id prior to 1.5).
603 -- This will keep links working after moves while
604 -- retaining the at-the-time name in the changes list.
605 rc_cur_id int(10) unsigned NOT NULL default '0',
606
607 -- rev_id of the given revision
608 rc_this_oldid int(10) unsigned NOT NULL default '0',
609
610 -- rev_id of the prior revision, for generating diff links.
611 rc_last_oldid int(10) unsigned NOT NULL default '0',
612
613 -- These may no longer be used, with the new move log.
614 rc_type tinyint(3) unsigned NOT NULL default '0',
615 rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0',
616 rc_moved_to_title varchar(255) binary NOT NULL default '',
617
618 -- If the Recent Changes Patrol option is enabled,
619 -- users may mark edits as having been reviewed to
620 -- remove a warning flag on the RC list.
621 -- A value of 1 indicates the page has been reviewed.
622 rc_patrolled tinyint(3) unsigned NOT NULL default '0',
623
624 -- Recorded IP address the edit was made from, if the
625 -- $wgPutIPinRC option is enabled.
626 rc_ip char(15) NOT NULL default '',
627
628 PRIMARY KEY rc_id (rc_id),
629 INDEX rc_timestamp (rc_timestamp),
630 INDEX rc_namespace_title (rc_namespace, rc_title),
631 INDEX rc_cur_id (rc_cur_id),
632 INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp),
633 INDEX rc_ip (rc_ip)
634 );
635
636 CREATE TABLE /*$wgDBprefix*/watchlist (
637 -- Key to user_id
638 wl_user int(5) unsigned NOT NULL,
639
640 -- Key to page_namespace/page_title
641 -- Note that users may watch patches which do not exist yet,
642 -- or existed in the past but have been deleted.
643 wl_namespace tinyint(2) unsigned NOT NULL default '0',
644 wl_title varchar(255) binary NOT NULL default '',
645
646 -- Timestamp when user was last sent a notification e-mail;
647 -- cleared when the user visits the page.
648 -- FIXME: add proper null support etc
649 wl_notificationtimestamp varchar(14) binary NOT NULL default '0',
650
651 UNIQUE KEY (wl_user, wl_namespace, wl_title),
652 KEY namespace_title (wl_namespace,wl_title)
653 );
654
655
656 --
657 -- Used by texvc math-rendering extension to keep track
658 -- of previously-rendered items.
659 --
660 CREATE TABLE /*$wgDBprefix*/math (
661 -- Binary MD5 hash of the latex fragment, used as an identifier key.
662 math_inputhash varchar(16) NOT NULL,
663
664 -- Not sure what this is, exactly...
665 math_outputhash varchar(16) NOT NULL,
666
667 -- texvc reports how well it thinks the HTML conversion worked;
668 -- if it's a low level the PNG rendering may be preferred.
669 math_html_conservativeness tinyint(1) NOT NULL,
670
671 -- HTML output from texvc, if any
672 math_html text,
673
674 -- MathML output from texvc, if any
675 math_mathml text,
676
677 UNIQUE KEY math_inputhash (math_inputhash)
678 );
679
680 --
681 -- When using the default MySQL search backend, page titles
682 -- and text are munged to strip markup, do Unicode case folding,
683 -- and prepare the result for MySQL's fulltext index.
684 --
685 -- This table must be MyISAM; InnoDB does not support the needed
686 -- fulltext index.
687 --
688 CREATE TABLE /*$wgDBprefix*/searchindex (
689 -- Key to page_id
690 si_page int(8) unsigned NOT NULL,
691
692 -- Munged version of title
693 si_title varchar(255) NOT NULL default '',
694
695 -- Munged version of body text
696 si_text mediumtext NOT NULL default '',
697
698 UNIQUE KEY (si_page),
699 FULLTEXT si_title (si_title),
700 FULLTEXT si_text (si_text)
701
702 ) TYPE=MyISAM;
703
704 --
705 -- Recognized interwiki link prefixes
706 --
707 CREATE TABLE /*$wgDBprefix*/interwiki (
708 -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
709 iw_prefix char(32) NOT NULL,
710
711 -- The URL of the wiki, with "$1" as a placeholder for an article name.
712 -- Any spaces in the name will be transformed to underscores before
713 -- insertion.
714 iw_url char(127) NOT NULL,
715
716 -- A boolean value indicating whether the wiki is in this project
717 -- (used, for example, to detect redirect loops)
718 iw_local BOOL NOT NULL,
719
720 UNIQUE KEY iw_prefix (iw_prefix)
721 );
722
723 --
724 -- Used for caching expensive grouped queries
725 --
726 CREATE TABLE /*$wgDBprefix*/querycache (
727 -- A key name, generally the base name of of the special page.
728 qc_type char(32) NOT NULL,
729
730 -- Some sort of stored value. Sizes, counts...
731 qc_value int(5) unsigned NOT NULL default '0',
732
733 -- Target namespace+title
734 qc_namespace tinyint(2) unsigned NOT NULL default '0',
735 qc_title char(255) binary NOT NULL default '',
736
737 KEY (qc_type,qc_value)
738 );
739
740 --
741 -- For a few generic cache operations if not using Memcached
742 --
743 CREATE TABLE /*$wgDBprefix*/objectcache (
744 keyname char(255) binary not null default '',
745 value mediumblob,
746 exptime datetime,
747 unique key (keyname),
748 key (exptime)
749 );
750
751 -- For storing revision text
752 -- This isn't used...
753 CREATE TABLE /*$wgDBprefix*/blobs (
754 blob_index char(255) binary NOT NULL default '',
755 blob_data longblob NOT NULL default '',
756 UNIQUE key blob_index (blob_index)
757 );
758
759 -- For article validation
760 CREATE TABLE /*$wgDBprefix*/validate (
761 `val_user` int(11) NOT NULL default '0',
762 `val_page` int(11) unsigned NOT NULL default '0',
763 `val_revision` int(11) unsigned NOT NULL default '0',
764 `val_type` int(11) unsigned NOT NULL default '0',
765 `val_value` int(11) default '0',
766 `val_comment` varchar(255) NOT NULL default '',
767 KEY `val_user` (`val_user`,`val_revision`)
768 ) TYPE=MyISAM;
769
770
771 CREATE TABLE /*$wgDBprefix*/logging (
772 -- Symbolic keys for the general log type and the action type
773 -- within the log. The output format will be controlled by the
774 -- action field, but only the type controls categorization.
775 log_type char(10) NOT NULL default '',
776 log_action char(10) NOT NULL default '',
777
778 -- Timestamp. Duh.
779 log_timestamp char(14) NOT NULL default '19700101000000',
780
781 -- The user who performed this action; key to user_id
782 log_user int unsigned NOT NULL default 0,
783
784 -- Key to the page affected. Where a user is the target,
785 -- this will point to the user page.
786 log_namespace tinyint unsigned NOT NULL default 0,
787 log_title varchar(255) binary NOT NULL default '',
788
789 -- Freeform text. Interpreted as edit history comments.
790 log_comment varchar(255) NOT NULL default '',
791
792 -- LF separated list of miscellaneous parameters
793 log_params blob NOT NULL default '',
794
795 KEY type_time (log_type, log_timestamp),
796 KEY user_time (log_user, log_timestamp),
797 KEY page_time (log_namespace, log_title, log_timestamp)
798 );
799
800
801
802
803
804 -- Hold group name and description
805 CREATE TABLE /*$wgDBprefix*/`group` (
806 group_id int(5) unsigned NOT NULL auto_increment,
807 group_name varchar(50) NOT NULL default '',
808 group_description varchar(255) NOT NULL default '',
809 group_rights tinyblob,
810 PRIMARY KEY (group_id)
811 );
812
813 -- Relation table between user and groups
814 CREATE TABLE /*$wgDBprefix*/user_groups (
815 ug_user int(5) unsigned NOT NULL default '0',
816 ug_group int(5) unsigned NOT NULL default '0',
817 PRIMARY KEY (ug_user,ug_group)
818 );