Display something nicer looking when the wiki hasn't been configured.
[mediawiki.git] / docs / schema.doc
blobe915dc2d31a0673144870e06bc1a2b8f7d283612
1 SCHEMA.DOC
3 The most up-to-date schema for the tables in the database
4 should always be "tables.sql" in the maintenance directory,
5 which is called from the installation script. Here are a
6 few highlights that may be out of date:
8 user    (Wikipedia users)
10   user_id
11     integer, primary key, autoincrement
12   user_name
13     Usernames must be unique, must not be in the form of
14     an IP address. _Shouldn't_ allow slashes or case
15     conflicts. Spaces are allowed, and are _not_ converted
16     to underscores like titles. (Conflicts?)
17   user_password
18     Hash of current password.
19   user_newpassword
20     Generated for mail-a-new-password feature
21   user_email
22     Note -- email should be restricted, not public info.
23     Same with passwords. ;)
24   user_options
25     Newline-separated list of name=value pairs.
26   user_token
27     A pseudorandomly generated value that is stored in
28     a cookie when the "remember password" feature is
29     used (previously, a hash of the password was used, but
30     this was vulnerable to cookie-stealing attacks)
34 cur     (Wikipedia "current" articles)
36   cur_id
37     integer, primary key, autoincrement
38   cur_namespace
39     integer index into list of namespaces.  See the
40     Namespace class for more details.
41   cur_title
42     Title of article (in dbkey form--see Title), without
43     namespace.  The combination of namespace,title should
44     be unique in this table.
45   cur_text
46     Wikitext of the article.
47   cur_comment
48     The summary of the last change.
49   cur_user
50     User id who made the last change, or 0 if unknown.
51   cur_user_text
52     Name of the user above, or IP address.
53   cur_timestamp
54     Time of the last change.
55   cur_minor_edit
56     Flag: 0 or 1 is last change was a "minor" edit.
57   cur_restrictions
58     Who may or may not edit the article.
59   cur_counter
60     Number of times this page has been viewed.
61   cur_ind_title
62     Text version of title for fulltext searches.
63   cur_ind_text
64     Plaintext version of text for fulltext searches.
65   cur_is_redirect
66     1 indicates the article is a redirect.
67   cur_minor_edit
68     1 indicates this was a minor edit.
69   cur_is_new
70     1 indicates this is the first revision of a new entry.
71   cur_random
72     Random value between 0 and 1, used for
73     Special:Randompage
77 old     (Historical versions articles. Most fields
78         correspond to the same fields in "cur")
80   old_id
81   old_namespace
82   old_title
83   old_text
84   old_comment
85   old_user
86   old_user_text
87   old_timestamp
88   old_minor_edit
89   old_flags
90     This last is currently unused.
94 archive (Temporary storage of deleted articles which may be restored.
95                 Fields correspond to those of "cur" and "old")
96   ar_namespace
97   ar_title
98   ar_text
99   ar_comment
100   ar_user
101   ar_user_text
102   ar_timestamp
103   ar_minor_edit
104   ar_flags
105     This last is currently unused.
109 links   (Internal links to existing articles)
111   l_from
112     ID of source article. (currently title, may be changed)
113   l_to
114     ID of target article.
118 brokenlinks (Internal links to non-existent articles)
120   bl_from
121     ID of source link.
122   bl_to
123     Title of target link.
127 imagelinks (Internal links to images via [[Image:filename]] syntax)
129   il_from
130     Title of target article.
131   il_to
132     Filename of target image.
136 categorylinks (Track category inclusions)
138   cl_from
139     corresponds to cur_id of the linking page
140   cl_to
141     corresponds to cur_title of the category page
142   cl_sortkey
143     the title of the linking page, or an optional override
144   cl_timestampe
145     when the link was last added
149 linkscc         (Stores (possibly gzipped) serialized objects with
150                 cache arrays to reduce database load slurping up
151                 from links and brokenlinks.)
152      
153   lcc_pageid
154     The ID of the linking page
155   lcc_cacheobj
156     A serialized LinkCache object
160 image (Uploaded images and other files)
162   img_name
163     Filename.
164   img_size
165     File size in bytes.
166   img_description
167     Description field given during upload.
168   img_user
169     User ID who uploaded the file.
170   img_user_text
171     User name who uploaded the file.
172   img_timestamp
173     Timestamp when upload took place.
177 oldimage (Old versions of images stored for potential revert)
179   oi_name
180     Original filename.
181   oi_archive_name
182     Filename of stored old revision; timestamp and
183     exclaimation point prepended to oi_name
184   oi_size
185     File size in bytes.
186   oi_description
187     Description field given during upload.
188   oi_user
189     User ID who uploaded the file.
190   oi_user_text
191     User name who uploaded the file.
192   oi_timestamp
193     Timestamp when upload took place.
197 ipblocks (IP addresses and users blocked from editing)
198   ipb_id
199     Primary key, introduced for privacy. 
200   ipb_address
201     Blocked IP address in dotted-quad form or user name.
202   ipb_user
203     Blocked user ID or 0 for IP blocks.
204   ipb_by
205     User ID who made the block.
206   ipb_reason
207     Text comment made by blocker.
208   ipb_timestamp
209     Creation (or refresh) date in standard YMDHMS form. IP
210     blocks expire automatically.
211   ipb_auto
212     Indicates that the IP address was banned because a banned
213     user accessed a page through it. If this is 1, ipb_address
214     will be hidden.
217 site_stats (Site-wide statistics)
219   ss_row_id
220     Token for where clauses.  There's only one row in
221     this table.  At some point we might want to use a
222     date here so we can get stats-by-date.
223   ss_total_views
224     Number of total views of all pages.
225   ss_total_edits
226     Number of total page edits.
227   ss_good_articles
228     Number of "countable" articles.
232 hitcounter (Stores an ID for every time any article is visited;
233             depending on $wgHitcounterUpdateFreq, it is
234             periodically cleared and the cur_counter column
235             in the cur table updated for the all articles
236             that have been visited.)
237   hc_id
238     The ID of an article, representing one hit
242 recentchanges
244   (Will document further when working)
248 watchlist
250   wl_user
251     Foreign key -> user_id
252   wl_namespace
253     Namespace -> cur_namespace
254     Note that these should only include even-numbered
255     namespaces for regular pages; associated talk pages
256     (odd numbered namespaces) are folded in.
257   wl_title
258     Page title -> cur_title
259     Note also that the linked page may not exist in page
260     or talk namespace, or at all.
263 searchindex     (Used for MySQL fulltext searching)
265   si_page
266     The ID of an article
267   si_title
268     The title of an article, indexed for searching
269   si_text
270     The text of an article, indexed for searching
274 interwiki       (Recognized interwiki link prefixes)
275   iw_prefix
276     The interwiki prefix, (e.g. "Meatball", or the
277     language prefix "de")
278   iw_url
279     The URL of the wiki, with "$1" as a placeholder
280     for an article name
281   iw_local
282     A boolean value indicating whether the wiki is
283     in this project (used, for example, to detect
284     redirect loops)
285   
286