Initial revision
[lhc/web/wiklou.git] / docs / schema.doc
1 SCHEMA.DOC
2
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 highlight that may be out of date:
7
8 user (Wikipedia users)
9
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_rights
18 Comma-separated list of textual flags.
19 user_password
20 Hash of current password.
21 user_newpassword
22 Generated for mail-a-new-password feature
23 user_email
24 Note -- email should be restricted, not public info.
25 Same with passwords. ;)
26 user_options
27 Newline-separated list of name=value pairs.
28
29
30
31 cur (Wikipedia "current" articles)
32
33 cur_id
34 integer, primary key, autoincrement
35 cur_namespace
36 integer index into list of namespaces. See the
37 Namespace class for more details.
38 cur_title
39 Title of article (in dbkey form--see Title), without
40 namespace. The combination of namespace,title should
41 be unique in this table.
42 cur_text
43 Wikitext of the article.
44 cur_comment
45 The summary of the last change.
46 cur_user
47 User id who made the last change, or 0 if unknown.
48 cur_user_text
49 Name of the user above, or IP address.
50 cur_timestamp
51 Time of the last change.
52 cur_minor_edit
53 Flag: 0 or 1 is last change was a "minor" edit.
54 cur_restrictions
55 Who may or may not edit the article.
56 cur_counter
57 Number of times this page has been viewed.
58 cur_ind_title
59 Text version of title for fulltext searches.
60 cur_ind_text
61 Plaintext version of text for fulltext searches.
62 cur_is_redirect
63 1 indicates the article is a redirect.
64 cur_minor_edit
65 1 indicates this was a minor edit.
66 cur_is_new
67 1 indicates this is the first revision of a new entry.
68
69
70
71 old (Historical versions articles. Most fields
72 correspond to the same fields in "cur")
73
74 old_id
75 old_namespace
76 old_title
77 old_text
78 old_comment
79 old_user
80 old_user_text
81 old_timestamp
82 old_minor_edit
83 old_flags
84 This last is currently unused.
85
86
87
88 archive (Temporary storage of deleted articles which may be restored.
89 Fields correspond to those of "cur" and "old")
90 ar_namespace
91 ar_title
92 ar_text
93 ar_comment
94 ar_user
95 ar_user_text
96 ar_timestamp
97 ar_minor_edit
98 ar_flags
99 This last is currently unused.
100
101
102
103 links (Internal links to existing articles)
104
105 l_from
106 ID of source article. (currently title, may be changed)
107 l_to
108 ID of target article.
109
110
111
112 brokenlinks (Internal links to non-existent articles)
113
114 bl_from
115 ID of source link.
116 bl_to
117 Title of target link.
118
119
120
121 imagelinks (Internal links to images via [[Image:filename]] syntax)
122
123 il_from
124 Title of target article.
125 il_to
126 Filename of target image.
127
128
129
130 image (Uploaded images and other files)
131
132 img_name
133 Filename.
134 img_size
135 File size in bytes.
136 img_description
137 Description field given during upload.
138 img_user
139 User ID who uploaded the file.
140 img_user_text
141 User name who uploaded the file.
142 img_timestamp
143 Timestamp when upload took place.
144
145
146
147 oldimage (Old versions of images stored for potential revert)
148
149 oi_name
150 Original filename.
151 oi_archive_name
152 Filename of stored old revision; timestamp and
153 exclaimation point prepended to oi_name
154 oi_size
155 File size in bytes.
156 oi_description
157 Description field given during upload.
158 oi_user
159 User ID who uploaded the file.
160 oi_user_text
161 User name who uploaded the file.
162 oi_timestamp
163 Timestamp when upload took place.
164
165
166
167 ipblocks (IP addresses and users blocked from editing)
168
169 ipb_address
170 Blocked IP address in dotted-quad form or ""
171 ipb_user
172 Blocked user ID or 0.
173 ipb_by
174 User ID who made the block.
175 ipb_reason
176 Text comment made by blocker.
177
178
179
180 random (Random page queue)
181
182 ra_current
183 1 = hasn't come up on a random page view yet.
184 >1 = has been viewed, will be ignored for a few
185 ra_title
186 Title of an article.
187
188
189
190 site_stats (Site-wide statistics)
191
192 ss_row_id
193 Token for where clauses. There's only one row in
194 this table. At some point we might want to use a
195 date here so we can get stats-by-date.
196 ss_total_views
197 Number of total views of all pages.
198 ss_total_edits
199 Number of total page edits.
200 ss_good_articles
201 Number of "countable" articles.
202
203
204
205 recentchanges
206
207 (Will document further when working)
208
209
210
211 watchlist
212
213 wl_user
214 Foreign key -> user_id
215 wl_namespace
216 Namespace -> cur_namespace
217 Note that these should only include even-numbered
218 namespaces for regular pages; associated talk pages
219 (odd numbered namespaces) are folded in.
220 wl_title
221 Page title -> cur_title
222 Note also that the linked page may not exist in page
223 or talk namespace, or at all.
224