1CREATE TABLE /*_*/user (
2  user_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
3  user_name varchar(255) binary NOT NULL default '',
4  user_real_name varchar(255) binary NOT NULL default '',
5  user_password tinyblob NOT NULL,
6  user_newpassword tinyblob NOT NULL,
7  user_newpass_time binary(14),
8  user_email tinytext NOT NULL,
9  user_touched binary(14) NOT NULL default '',
10  user_token binary(32) NOT NULL default '',
11  user_email_authenticated binary(14),
12  user_email_token binary(32),
13  user_email_token_expires binary(14),
14  user_registration binary(14),
15  user_editcount int,
16  user_password_expires varbinary(14) DEFAULT NULL
17
18) /*$wgDBTableOptions*/;
19
20CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name);
21CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token);
22CREATE INDEX /*i*/user_email ON /*_*/user (user_email(50));
23CREATE TABLE /*_*/actor (
24  actor_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
25  actor_user int unsigned,
26  actor_name varchar(255) binary NOT NULL
27) /*$wgDBTableOptions*/;
28CREATE UNIQUE INDEX /*i*/actor_user ON /*_*/actor (actor_user);
29CREATE UNIQUE INDEX /*i*/actor_name ON /*_*/actor (actor_name);
30CREATE TABLE /*_*/user_groups (
31  ug_user int unsigned NOT NULL default 0,
32  ug_group varbinary(255) NOT NULL default '',
33  ug_expiry varbinary(14) NULL default NULL,
34
35  PRIMARY KEY (ug_user, ug_group)
36) /*$wgDBTableOptions*/;
37
38CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group);
39CREATE INDEX /*i*/ug_expiry ON /*_*/user_groups (ug_expiry);
40CREATE TABLE /*_*/user_former_groups (
41  ufg_user int unsigned NOT NULL default 0,
42  ufg_group varbinary(255) NOT NULL default '',
43  PRIMARY KEY (ufg_user,ufg_group)
44) /*$wgDBTableOptions*/;
45CREATE TABLE /*_*/user_newtalk (
46  user_id int unsigned NOT NULL default 0,
47  user_ip varbinary(40) NOT NULL default '',
48  user_last_timestamp varbinary(14) NULL default NULL
49) /*$wgDBTableOptions*/;
50CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
51CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
52CREATE TABLE /*_*/user_properties (
53  up_user int unsigned NOT NULL,
54  up_property varbinary(255) NOT NULL,
55  up_value blob,
56  PRIMARY KEY (up_user,up_property)
57) /*$wgDBTableOptions*/;
58
59CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
60CREATE TABLE /*_*/bot_passwords (
61  bp_user int unsigned NOT NULL,
62  bp_app_id varbinary(32) NOT NULL,
63  bp_password tinyblob NOT NULL,
64  bp_token binary(32) NOT NULL default '',
65  bp_restrictions blob NOT NULL,
66  bp_grants blob NOT NULL,
67
68  PRIMARY KEY ( bp_user, bp_app_id )
69) /*$wgDBTableOptions*/;
70CREATE TABLE /*_*/page (
71  page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
72  page_namespace int NOT NULL,
73  page_title varchar(255) binary NOT NULL,
74  page_restrictions tinyblob NOT NULL,
75  page_is_redirect tinyint unsigned NOT NULL default 0,
76  page_is_new tinyint unsigned NOT NULL default 0,
77  page_random real unsigned NOT NULL,
78  page_touched binary(14) NOT NULL default '',
79  page_links_updated varbinary(14) NULL default NULL,
80  page_latest int unsigned NOT NULL,
81  page_len int unsigned NOT NULL,
82  page_content_model varbinary(32) DEFAULT NULL,
83  page_lang varbinary(35) DEFAULT NULL
84) /*$wgDBTableOptions*/;
85CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
86CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
87CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
88CREATE INDEX /*i*/page_redirect_namespace_len ON /*_*/page (page_is_redirect, page_namespace, page_len);
89CREATE TABLE /*_*/revision (
90  rev_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
91  rev_page int unsigned NOT NULL,
92  rev_text_id int unsigned NOT NULL default 0,
93  rev_comment varbinary(767) NOT NULL default '',
94  rev_user int unsigned NOT NULL default 0,
95  rev_user_text varchar(255) binary NOT NULL default '',
96  rev_timestamp binary(14) NOT NULL default '',
97  rev_minor_edit tinyint unsigned NOT NULL default 0,
98  rev_deleted tinyint unsigned NOT NULL default 0,
99  rev_len int unsigned,
100  rev_parent_id int unsigned default NULL,
101  rev_sha1 varbinary(32) NOT NULL default '',
102  rev_content_model varbinary(32) DEFAULT NULL,
103  rev_content_format varbinary(64) DEFAULT NULL
104
105) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
106CREATE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
107CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
108CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
109CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
110CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
111CREATE INDEX /*i*/page_user_timestamp ON /*_*/revision (rev_page,rev_user,rev_timestamp);
112CREATE TABLE /*_*/revision_comment_temp (
113  revcomment_rev int unsigned NOT NULL,
114  revcomment_comment_id bigint unsigned NOT NULL,
115  PRIMARY KEY (revcomment_rev, revcomment_comment_id)
116) /*$wgDBTableOptions*/;
117CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
118CREATE TABLE /*_*/revision_actor_temp (
119  revactor_rev int unsigned NOT NULL,
120  revactor_actor bigint unsigned NOT NULL,
121  revactor_timestamp binary(14) NOT NULL default '',
122  revactor_page int unsigned NOT NULL,
123  PRIMARY KEY (revactor_rev, revactor_actor)
124) /*$wgDBTableOptions*/;
125CREATE UNIQUE INDEX /*i*/revactor_rev ON /*_*/revision_actor_temp (revactor_rev);
126CREATE INDEX /*i*/actor_timestamp ON /*_*/revision_actor_temp (revactor_actor,revactor_timestamp);
127CREATE INDEX /*i*/page_actor_timestamp ON /*_*/revision_actor_temp (revactor_page,revactor_actor,revactor_timestamp);
128CREATE TABLE /*_*/ip_changes (
129  ipc_rev_id int unsigned NOT NULL PRIMARY KEY DEFAULT '0',
130  ipc_rev_timestamp binary(14) NOT NULL DEFAULT '',
131  ipc_hex varbinary(35) NOT NULL DEFAULT ''
132
133) /*$wgDBTableOptions*/;
134
135CREATE INDEX /*i*/ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
136CREATE INDEX /*i*/ipc_hex_time ON /*_*/ip_changes (ipc_hex,ipc_rev_timestamp);
137CREATE TABLE /*_*/text (
138  old_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
139  old_text mediumblob NOT NULL,
140  old_flags tinyblob NOT NULL
141) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=10240;
142CREATE TABLE /*_*/comment (
143  comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
144  comment_hash INT NOT NULL,
145  comment_text BLOB NOT NULL,
146  comment_data BLOB
147) /*$wgDBTableOptions*/;
148CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash);
149CREATE TABLE /*_*/archive (
150  ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
151  ar_namespace int NOT NULL default 0,
152  ar_title varchar(255) binary NOT NULL default '',
153  ar_comment varbinary(767) NOT NULL default '', -- Deprecated in favor of ar_comment_id
154  ar_comment_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ar_comment should be used)
155  ar_user int unsigned NOT NULL default 0, -- Deprecated in favor of ar_actor
156  ar_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of ar_actor
157  ar_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ar_user/ar_user_text should be used)
158  ar_timestamp binary(14) NOT NULL default '',
159  ar_minor_edit tinyint NOT NULL default 0,
160  ar_rev_id int unsigned NOT NULL,
161  ar_text_id int unsigned NOT NULL DEFAULT 0,
162  ar_deleted tinyint unsigned NOT NULL default 0,
163  ar_len int unsigned,
164  ar_page_id int unsigned,
165  ar_parent_id int unsigned default NULL,
166  ar_sha1 varbinary(32) NOT NULL default '',
167  ar_content_model varbinary(32) DEFAULT NULL,
168  ar_content_format varbinary(64) DEFAULT NULL
169) /*$wgDBTableOptions*/;
170CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
171CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
172CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp);
173CREATE UNIQUE INDEX /*i*/ar_revid_uniq ON /*_*/archive (ar_rev_id);
174CREATE TABLE /*_*/slots (
175  slot_revision_id bigint unsigned NOT NULL,
176  slot_role_id smallint unsigned NOT NULL,
177  slot_content_id bigint unsigned NOT NULL,
178  slot_origin bigint unsigned NOT NULL,
179
180  PRIMARY KEY ( slot_revision_id, slot_role_id )
181) /*$wgDBTableOptions*/;
182CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
183CREATE TABLE /*_*/content (
184  content_id bigint unsigned PRIMARY KEY AUTO_INCREMENT,
185  content_size int unsigned NOT NULL,
186  content_sha1 varbinary(32) NOT NULL,
187  content_model smallint unsigned NOT NULL,
188  content_address varbinary(255) NOT NULL
189) /*$wgDBTableOptions*/;
190CREATE TABLE /*_*/slot_roles (
191  role_id smallint PRIMARY KEY AUTO_INCREMENT,
192  role_name varbinary(64) NOT NULL
193) /*$wgDBTableOptions*/;
194CREATE UNIQUE INDEX /*i*/role_name ON /*_*/slot_roles (role_name);
195CREATE TABLE /*_*/content_models (
196  model_id smallint PRIMARY KEY AUTO_INCREMENT,
197  model_name varbinary(64) NOT NULL
198) /*$wgDBTableOptions*/;
199CREATE UNIQUE INDEX /*i*/model_name ON /*_*/content_models (model_name);
200CREATE TABLE /*_*/pagelinks (
201  pl_from int unsigned NOT NULL default 0,
202  pl_from_namespace int NOT NULL default 0,
203  pl_namespace int NOT NULL default 0,
204  pl_title varchar(255) binary NOT NULL default '',
205  PRIMARY KEY (pl_from,pl_namespace,pl_title)
206) /*$wgDBTableOptions*/;
207CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
208CREATE INDEX /*i*/pl_backlinks_namespace ON /*_*/pagelinks (pl_from_namespace,pl_namespace,pl_title,pl_from);
209CREATE TABLE /*_*/templatelinks (
210  tl_from int unsigned NOT NULL default 0,
211  tl_from_namespace int NOT NULL default 0,
212  tl_namespace int NOT NULL default 0,
213  tl_title varchar(255) binary NOT NULL default '',
214  PRIMARY KEY (tl_from,tl_namespace,tl_title)
215) /*$wgDBTableOptions*/;
216CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
217CREATE INDEX /*i*/tl_backlinks_namespace ON /*_*/templatelinks (tl_from_namespace,tl_namespace,tl_title,tl_from);
218CREATE TABLE /*_*/imagelinks (
219  il_from int unsigned NOT NULL default 0,
220  il_from_namespace int NOT NULL default 0,
221  il_to varchar(255) binary NOT NULL default '',
222  PRIMARY KEY (il_from,il_to)
223) /*$wgDBTableOptions*/;
224CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
225CREATE INDEX /*i*/il_backlinks_namespace ON /*_*/imagelinks (il_from_namespace,il_to,il_from);
226CREATE TABLE /*_*/categorylinks (
227  cl_from int unsigned NOT NULL default 0,
228  cl_to varchar(255) binary NOT NULL default '',
229  cl_sortkey varbinary(230) NOT NULL default '',
230  cl_sortkey_prefix varchar(255) binary NOT NULL default '',
231  cl_timestamp timestamp NOT NULL,
232  cl_collation varbinary(32) NOT NULL default '',
233  cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
234  PRIMARY KEY (cl_from,cl_to)
235) /*$wgDBTableOptions*/;
236CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_type,cl_sortkey,cl_from);
237CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
238CREATE INDEX /*i*/cl_collation_ext ON /*_*/categorylinks (cl_collation, cl_to, cl_type, cl_from);
239CREATE TABLE /*_*/category (
240  cat_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
241  cat_title varchar(255) binary NOT NULL,
242  cat_pages int signed NOT NULL default 0,
243  cat_subcats int signed NOT NULL default 0,
244  cat_files int signed NOT NULL default 0
245) /*$wgDBTableOptions*/;
246
247CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category (cat_title);
248CREATE INDEX /*i*/cat_pages ON /*_*/category (cat_pages);
249CREATE TABLE /*_*/externallinks (
250  el_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
251  el_from int unsigned NOT NULL default 0,
252  el_to blob NOT NULL,
253  el_index blob NOT NULL,
254  el_index_60 varbinary(60) NOT NULL
255) /*$wgDBTableOptions*/;
256CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
257CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
258CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
259CREATE INDEX /*i*/el_index_60 ON /*_*/externallinks (el_index_60, el_id);
260CREATE INDEX /*i*/el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
261CREATE TABLE /*_*/langlinks (
262  ll_from int unsigned NOT NULL default 0,
263  ll_lang varbinary(20) NOT NULL default '',
264  ll_title varchar(255) binary NOT NULL default '',
265  PRIMARY KEY (ll_from,ll_lang)
266) /*$wgDBTableOptions*/;
267CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
268CREATE TABLE /*_*/iwlinks (
269  iwl_from int unsigned NOT NULL default 0,
270  iwl_prefix varbinary(20) NOT NULL default '',
271  iwl_title varchar(255) binary NOT NULL default '',
272  PRIMARY KEY (iwl_from,iwl_prefix,iwl_title)
273) /*$wgDBTableOptions*/;
274CREATE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
275CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
276CREATE TABLE /*_*/site_stats (
277  ss_row_id int unsigned NOT NULL PRIMARY KEY,
278  ss_total_edits bigint unsigned default NULL,
279  ss_good_articles bigint unsigned default NULL,
280  ss_total_pages bigint unsigned default NULL,
281  ss_users bigint unsigned default NULL,
282  ss_active_users bigint unsigned default NULL,
283  ss_images bigint unsigned default NULL
284) /*$wgDBTableOptions*/;
285CREATE TABLE /*_*/ipblocks (
286  ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
287  ipb_address tinyblob NOT NULL,
288  ipb_user int unsigned NOT NULL default 0,
289  ipb_by int unsigned NOT NULL default 0, -- Deprecated in favor of ipb_by_actor
290  ipb_by_text varchar(255) binary NOT NULL default '', -- Deprecated in favor of ipb_by_actor
291  ipb_by_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that ipb_by/ipb_by_text should be used)
292  ipb_reason varbinary(767) NOT NULL default '',
293  ipb_reason_id bigint unsigned NOT NULL DEFAULT 0,
294  ipb_timestamp binary(14) NOT NULL default '',
295  ipb_auto bool NOT NULL default 0,
296  ipb_anon_only bool NOT NULL default 0,
297  ipb_create_account bool NOT NULL default 1,
298  ipb_enable_autoblock bool NOT NULL default '1',
299  ipb_expiry varbinary(14) NOT NULL default '',
300  ipb_range_start tinyblob NOT NULL,
301  ipb_range_end tinyblob NOT NULL,
302  ipb_deleted bool NOT NULL default 0,
303  ipb_block_email bool NOT NULL default 0,
304  ipb_allow_usertalk bool NOT NULL default 0,
305  ipb_parent_block_id int default NULL,
306  ipb_sitewide bool NOT NULL default 1
307
308) /*$wgDBTableOptions*/;
309CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
310CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
311CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
312CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
313CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
314CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
315CREATE TABLE /*_*/ipblocks_restrictions (
316  ir_ipb_id int NOT NULL,
317  ir_type tinyint(1) NOT NULL,
318  ir_value int NOT NULL,
319
320  PRIMARY KEY (ir_ipb_id, ir_type, ir_value)
321) /*$wgDBTableOptions*/;
322CREATE INDEX /*i*/ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
323CREATE TABLE /*_*/image (
324  img_name varchar(255) binary NOT NULL default '' PRIMARY KEY,
325  img_size int unsigned NOT NULL default 0,
326  img_width int NOT NULL default 0,
327  img_height int NOT NULL default 0,
328  img_metadata mediumblob NOT NULL,
329  img_bits int NOT NULL default 0,
330  img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
331  img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
332  img_minor_mime varbinary(100) NOT NULL default "unknown",
333  img_description varbinary(767) NOT NULL default '',
334
335  img_description_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that img_description should be used)
336  img_user int unsigned NOT NULL default 0,
337  img_user_text varchar(255) binary NOT NULL DEFAULT '',
338  img_actor bigint unsigned NOT NULL DEFAULT 0,
339  img_timestamp varbinary(14) NOT NULL default '',
340  img_sha1 varbinary(32) NOT NULL default ''
341) /*$wgDBTableOptions*/;
342CREATE INDEX /*i*/img_user_timestamp ON /*_*/image (img_user,img_timestamp);
343CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
344CREATE INDEX /*i*/img_actor_timestamp ON /*_*/image (img_actor,img_timestamp);
345CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
346CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
347CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1(10));
348CREATE INDEX /*i*/img_media_mime ON /*_*/image (img_media_type,img_major_mime,img_minor_mime);
349CREATE TABLE /*_*/oldimage (
350  oi_name varchar(255) binary NOT NULL default '',
351  oi_archive_name varchar(255) binary NOT NULL default '',
352  oi_size int unsigned NOT NULL default 0,
353  oi_width int NOT NULL default 0,
354  oi_height int NOT NULL default 0,
355  oi_bits int NOT NULL default 0,
356  oi_description varbinary(767) NOT NULL default '', -- Deprecated.
357  oi_description_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that oi_description should be used)
358  oi_user int unsigned NOT NULL default 0, -- Deprecated in favor of oi_actor
359  oi_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of oi_actor
360  oi_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that oi_user/oi_user_text should be used)
361  oi_timestamp binary(14) NOT NULL default '',
362
363  oi_metadata mediumblob NOT NULL,
364  oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
365  oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") NOT NULL default "unknown",
366  oi_minor_mime varbinary(100) NOT NULL default "unknown",
367  oi_deleted tinyint unsigned NOT NULL default 0,
368  oi_sha1 varbinary(32) NOT NULL default ''
369) /*$wgDBTableOptions*/;
370
371CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
372CREATE INDEX /*i*/oi_actor_timestamp ON /*_*/oldimage (oi_actor,oi_timestamp);
373CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
374CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
375CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10));
376CREATE TABLE /*_*/filearchive (
377  fa_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
378  fa_name varchar(255) binary NOT NULL default '',
379  fa_archive_name varchar(255) binary default '',
380  fa_storage_group varbinary(16),
381  fa_storage_key varbinary(64) default '',
382  fa_deleted_user int,
383  fa_deleted_timestamp binary(14) default '',
384  fa_deleted_reason varbinary(767) default '', -- Deprecated
385  fa_deleted_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_deleted_reason should be used)
386  fa_size int unsigned default 0,
387  fa_width int default 0,
388  fa_height int default 0,
389  fa_metadata mediumblob,
390  fa_bits int default 0,
391  fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
392  fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart", "chemical") default "unknown",
393  fa_minor_mime varbinary(100) default "unknown",
394  fa_description varbinary(767) default '', -- Deprecated
395  fa_description_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_description should be used)
396  fa_user int unsigned default 0, -- Deprecated in favor of fa_actor
397  fa_user_text varchar(255) binary DEFAULT '', -- Deprecated in favor of fa_actor
398  fa_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that fa_user/fa_user_text should be used)
399  fa_timestamp binary(14) default '',
400  fa_deleted tinyint unsigned NOT NULL default 0,
401  fa_sha1 varbinary(32) NOT NULL default ''
402) /*$wgDBTableOptions*/;
403CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
404CREATE INDEX /*i*/fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key);
405CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
406CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
407CREATE INDEX /*i*/fa_actor_timestamp ON /*_*/filearchive (fa_actor,fa_timestamp);
408CREATE INDEX /*i*/fa_sha1 ON /*_*/filearchive (fa_sha1(10));
409CREATE TABLE /*_*/uploadstash (
410  us_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
411  us_user int unsigned NOT NULL,
412  us_key varchar(255) NOT NULL,
413  us_orig_path varchar(255) NOT NULL,
414  us_path varchar(255) NOT NULL,
415  us_source_type varchar(50),
416  us_timestamp varbinary(14) NOT NULL,
417
418  us_status varchar(50) NOT NULL,
419  us_chunk_inx int unsigned NULL,
420  us_props blob,
421  us_size int unsigned NOT NULL,
422  us_sha1 varchar(31) NOT NULL,
423  us_mime varchar(255),
424  us_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
425  us_image_width int unsigned,
426  us_image_height int unsigned,
427  us_image_bits smallint unsigned
428
429) /*$wgDBTableOptions*/;
430CREATE INDEX /*i*/us_user ON /*_*/uploadstash (us_user);
431CREATE UNIQUE INDEX /*i*/us_key ON /*_*/uploadstash (us_key);
432CREATE INDEX /*i*/us_timestamp ON /*_*/uploadstash (us_timestamp);
433CREATE TABLE /*_*/recentchanges (
434  rc_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
435  rc_timestamp varbinary(14) NOT NULL default '',
436  rc_user int unsigned NOT NULL default 0, -- Deprecated in favor of rc_actor
437  rc_user_text varchar(255) binary NOT NULL DEFAULT '', -- Deprecated in favor of rc_actor
438  rc_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that rc_user/rc_user_text should be used)
439  rc_namespace int NOT NULL default 0,
440  rc_title varchar(255) binary NOT NULL default '',
441  rc_comment varbinary(767) NOT NULL default '', -- Deprecated.
442  rc_comment_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that rc_comment should be used)
443  rc_minor tinyint unsigned NOT NULL default 0,
444  rc_bot tinyint unsigned NOT NULL default 0,
445  rc_new tinyint unsigned NOT NULL default 0,
446  rc_cur_id int unsigned NOT NULL default 0,
447  rc_this_oldid int unsigned NOT NULL default 0,
448  rc_last_oldid int unsigned NOT NULL default 0,
449  rc_type tinyint unsigned NOT NULL default 0,
450  rc_source varchar(16) binary not null default '',
451  rc_patrolled tinyint unsigned NOT NULL default 0,
452  rc_ip varbinary(40) NOT NULL default '',
453  rc_old_len int,
454  rc_new_len int,
455  rc_deleted tinyint unsigned NOT NULL default 0,
456  rc_logid int unsigned NOT NULL default 0,
457  rc_log_type varbinary(255) NULL default NULL,
458  rc_log_action varbinary(255) NULL default NULL,
459  rc_params blob NULL
460) /*$wgDBTableOptions*/;
461CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
462CREATE INDEX /*i*/rc_namespace_title_timestamp ON /*_*/recentchanges (rc_namespace, rc_title, rc_timestamp);
463CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
464CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
465CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
466CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
467CREATE INDEX /*i*/rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
468CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
469CREATE INDEX /*i*/rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
470CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
471CREATE INDEX /*i*/rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
472
473CREATE TABLE /*_*/watchlist (
474  wl_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
475  wl_user int unsigned NOT NULL,
476  wl_namespace int NOT NULL default 0,
477  wl_title varchar(255) binary NOT NULL default '',
478  wl_notificationtimestamp varbinary(14)
479
480) /*$wgDBTableOptions*/;
481CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
482CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
483CREATE INDEX /*i*/wl_user_notificationtimestamp ON /*_*/watchlist (wl_user, wl_notificationtimestamp);
484CREATE TABLE /*_*/searchindex (
485  si_page int unsigned NOT NULL,
486  si_title varchar(255) NOT NULL default '',
487  si_text mediumtext NOT NULL
488) ENGINE=MyISAM DEFAULT CHARSET=utf8;
489
490CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
491CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title);
492CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text);
493CREATE TABLE /*_*/interwiki (
494  iw_prefix varchar(32) NOT NULL PRIMARY KEY,
495  iw_url blob NOT NULL,
496  iw_api blob NOT NULL,
497  iw_wikiid varchar(64) NOT NULL,
498  iw_local bool NOT NULL,
499  iw_trans tinyint NOT NULL default 0
500) /*$wgDBTableOptions*/;
501CREATE TABLE /*_*/querycache (
502  qc_type varbinary(32) NOT NULL,
503  qc_value int unsigned NOT NULL default 0,
504  qc_namespace int NOT NULL default 0,
505  qc_title varchar(255) binary NOT NULL default ''
506) /*$wgDBTableOptions*/;
507
508CREATE INDEX /*i*/qc_type ON /*_*/querycache (qc_type,qc_value);
509CREATE TABLE /*_*/objectcache (
510  keyname varbinary(255) NOT NULL default '' PRIMARY KEY,
511  value mediumblob,
512  exptime datetime
513) /*$wgDBTableOptions*/;
514CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
515
516
517CREATE TABLE /*_*/logging (
518  log_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
519  log_type varbinary(32) NOT NULL default '',
520  log_action varbinary(32) NOT NULL default '',
521  log_timestamp binary(14) NOT NULL default '19700101000000',
522  log_user int unsigned NOT NULL default 0, -- Deprecated in favor of log_actor
523  log_user_text varchar(255) binary NOT NULL default '', -- Deprecated in favor of log_actor
524  log_actor bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that log_user/log_user_text should be used)
525  log_namespace int NOT NULL default 0,
526  log_title varchar(255) binary NOT NULL default '',
527  log_page int unsigned NULL,
528  log_comment varbinary(767) NOT NULL default '',
529  log_comment_id bigint unsigned NOT NULL DEFAULT 0,
530  log_params blob NOT NULL,
531  log_deleted tinyint unsigned NOT NULL default 0
532) /*$wgDBTableOptions*/;
533CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
534CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
535CREATE INDEX /*i*/actor_time ON /*_*/logging (log_actor, log_timestamp);
536CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
537CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
538CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp);
539CREATE INDEX /*i*/log_actor_type_time ON /*_*/logging (log_actor, log_type, log_timestamp);
540CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp);
541CREATE INDEX /*i*/log_type_action ON /*_*/logging (log_type, log_action, log_timestamp);
542CREATE INDEX /*i*/log_user_text_type_time ON /*_*/logging (log_user_text, log_type, log_timestamp);
543CREATE INDEX /*i*/log_user_text_time ON /*_*/logging (log_user_text, log_timestamp);
544
545
546CREATE TABLE /*_*/log_search (
547  ls_field varbinary(32) NOT NULL,
548  ls_value varchar(255) NOT NULL,
549  ls_log_id int unsigned NOT NULL default 0,
550  PRIMARY KEY (ls_field,ls_value,ls_log_id)
551) /*$wgDBTableOptions*/;
552CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
553CREATE TABLE /*_*/job (
554  job_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
555  job_cmd varbinary(60) NOT NULL default '',
556  job_namespace int NOT NULL,
557  job_title varchar(255) binary NOT NULL,
558  job_timestamp varbinary(14) NULL default NULL,
559  job_params blob NOT NULL,
560  job_random integer unsigned NOT NULL default 0,
561  job_attempts integer unsigned NOT NULL default 0,
562  job_token varbinary(32) NOT NULL default '',
563  job_token_timestamp varbinary(14) NULL default NULL,
564  job_sha1 varbinary(32) NOT NULL default ''
565) /*$wgDBTableOptions*/;
566
567CREATE INDEX /*i*/job_sha1 ON /*_*/job (job_sha1);
568CREATE INDEX /*i*/job_cmd_token ON /*_*/job (job_cmd,job_token,job_random);
569CREATE INDEX /*i*/job_cmd_token_id ON /*_*/job (job_cmd,job_token,job_id);
570CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title, job_params(128));
571CREATE INDEX /*i*/job_timestamp ON /*_*/job (job_timestamp);
572CREATE TABLE /*_*/querycache_info (
573  qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
574  qci_timestamp binary(14) NOT NULL default '19700101000000'
575) /*$wgDBTableOptions*/;
576CREATE TABLE /*_*/redirect (
577  rd_from int unsigned NOT NULL default 0 PRIMARY KEY,
578  rd_namespace int NOT NULL default 0,
579  rd_title varchar(255) binary NOT NULL default '',
580  rd_interwiki varchar(32) default NULL,
581  rd_fragment varchar(255) binary default NULL
582) /*$wgDBTableOptions*/;
583
584CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
585CREATE TABLE /*_*/querycachetwo (
586  qcc_type varbinary(32) NOT NULL,
587  qcc_value int unsigned NOT NULL default 0,
588  qcc_namespace int NOT NULL default 0,
589  qcc_title varchar(255) binary NOT NULL default '',
590  qcc_namespacetwo int NOT NULL default 0,
591  qcc_titletwo varchar(255) binary NOT NULL default ''
592) /*$wgDBTableOptions*/;
593
594CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
595CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
596CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
597CREATE TABLE /*_*/page_restrictions (
598  pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
599  pr_page int NOT NULL,
600  pr_type varbinary(60) NOT NULL,
601  pr_level varbinary(60) NOT NULL,
602  pr_cascade tinyint NOT NULL,
603  pr_user int unsigned NULL,
604  pr_expiry varbinary(14) NULL
605) /*$wgDBTableOptions*/;
606
607CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
608CREATE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
609CREATE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level);
610CREATE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade);
611CREATE TABLE /*_*/protected_titles (
612  pt_namespace int NOT NULL,
613  pt_title varchar(255) binary NOT NULL,
614  pt_user int unsigned NOT NULL,
615  pt_reason varbinary(767) default '', -- Deprecated.
616  pt_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that pt_reason should be used)
617  pt_timestamp binary(14) NOT NULL,
618  pt_expiry varbinary(14) NOT NULL default '',
619  pt_create_perm varbinary(60) NOT NULL,
620
621  PRIMARY KEY (pt_namespace,pt_title)
622) /*$wgDBTableOptions*/;
623
624CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
625CREATE TABLE /*_*/page_props (
626  pp_page int NOT NULL,
627  pp_propname varbinary(60) NOT NULL,
628  pp_value blob NOT NULL,
629  pp_sortkey float DEFAULT NULL,
630
631  PRIMARY KEY (pp_page,pp_propname)
632) /*$wgDBTableOptions*/;
633
634CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
635CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
636CREATE TABLE /*_*/updatelog (
637  ul_key varchar(255) NOT NULL PRIMARY KEY,
638  ul_value blob
639) /*$wgDBTableOptions*/;
640CREATE TABLE /*_*/change_tag (
641  ct_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
642  ct_rc_id int NULL,
643  ct_log_id int unsigned NULL,
644  ct_rev_id int unsigned NULL,
645  ct_tag varchar(255) NOT NULL default '',
646  ct_params blob NULL,
647  ct_tag_id int unsigned NULL
648) /*$wgDBTableOptions*/;
649
650CREATE INDEX /*i*/change_tag_rc_tag_nonuniq ON /*_*/change_tag (ct_rc_id,ct_tag);
651CREATE INDEX /*i*/change_tag_log_tag_nonuniq ON /*_*/change_tag (ct_log_id,ct_tag);
652CREATE INDEX /*i*/change_tag_rev_tag_nonuniq ON /*_*/change_tag (ct_rev_id,ct_tag);
653
654CREATE UNIQUE INDEX /*i*/change_tag_rc_tag_id ON /*_*/change_tag (ct_rc_id,ct_tag_id);
655CREATE UNIQUE INDEX /*i*/change_tag_log_tag_id ON /*_*/change_tag (ct_log_id,ct_tag_id);
656CREATE UNIQUE INDEX /*i*/change_tag_rev_tag_id ON /*_*/change_tag (ct_rev_id,ct_tag_id);
657CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
658CREATE INDEX /*i*/change_tag_tag_id_id ON /*_*/change_tag (ct_tag_id,ct_rc_id,ct_rev_id,ct_log_id);
659CREATE TABLE /*_*/tag_summary (
660  ts_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
661  ts_rc_id int NULL,
662  ts_log_id int unsigned NULL,
663  ts_rev_id int unsigned NULL,
664  ts_tags blob NOT NULL
665) /*$wgDBTableOptions*/;
666
667CREATE UNIQUE INDEX /*i*/tag_summary_rc_id ON /*_*/tag_summary (ts_rc_id);
668CREATE UNIQUE INDEX /*i*/tag_summary_log_id ON /*_*/tag_summary (ts_log_id);
669CREATE UNIQUE INDEX /*i*/tag_summary_rev_id ON /*_*/tag_summary (ts_rev_id);
670
671
672CREATE TABLE /*_*/valid_tag (
673  vt_tag varchar(255) NOT NULL PRIMARY KEY
674) /*$wgDBTableOptions*/;
675CREATE TABLE /*_*/l10n_cache (
676  lc_lang varbinary(32) NOT NULL,
677  lc_key varchar(255) NOT NULL,
678  lc_value mediumblob NOT NULL,
679  PRIMARY KEY (lc_lang, lc_key)
680) /*$wgDBTableOptions*/;
681CREATE TABLE /*_*/module_deps (
682  md_module varbinary(255) NOT NULL,
683  md_skin varbinary(32) NOT NULL,
684  md_deps mediumblob NOT NULL,
685  PRIMARY KEY (md_module,md_skin)
686) /*$wgDBTableOptions*/;
687CREATE TABLE /*_*/sites (
688  site_id                    INT UNSIGNED        NOT NULL PRIMARY KEY AUTO_INCREMENT,
689  site_global_key            varbinary(32)       NOT NULL,
690  site_type                  varbinary(32)       NOT NULL,
691  site_group                 varbinary(32)       NOT NULL,
692  site_source                varbinary(32)       NOT NULL,
693  site_language              varbinary(32)       NOT NULL,
694  site_protocol              varbinary(32)       NOT NULL,
695  site_domain                VARCHAR(255)        NOT NULL,
696  site_data                  BLOB                NOT NULL,
697  site_forward              bool                NOT NULL,
698  site_config               BLOB                NOT NULL
699) /*$wgDBTableOptions*/;
700
701CREATE UNIQUE INDEX /*i*/sites_global_key ON /*_*/sites (site_global_key);
702CREATE INDEX /*i*/sites_type ON /*_*/sites (site_type);
703CREATE INDEX /*i*/sites_group ON /*_*/sites (site_group);
704CREATE INDEX /*i*/sites_source ON /*_*/sites (site_source);
705CREATE INDEX /*i*/sites_language ON /*_*/sites (site_language);
706CREATE INDEX /*i*/sites_protocol ON /*_*/sites (site_protocol);
707CREATE INDEX /*i*/sites_domain ON /*_*/sites (site_domain);
708CREATE INDEX /*i*/sites_forward ON /*_*/sites (site_forward);
709CREATE TABLE /*_*/site_identifiers (
710  si_site                    INT UNSIGNED        NOT NULL,
711  si_type                    varbinary(32)       NOT NULL,
712  si_key                     varbinary(32)       NOT NULL,
713
714  PRIMARY KEY (si_type, si_key)
715) /*$wgDBTableOptions*/;
716
717CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
718CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);
719CREATE TABLE /*_*/change_tag_def (
720    ctd_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
721    ctd_name varbinary(255) NOT NULL,
722    ctd_user_defined tinyint(1) NOT NULL,
723    ctd_count bigint unsigned NOT NULL default 0
724) /*$wgDBTableOptions*/;
725
726CREATE UNIQUE INDEX /*i*/ctd_name ON /*_*/change_tag_def (ctd_name);
727CREATE INDEX /*i*/ctd_count ON /*_*/change_tag_def (ctd_count);
728CREATE INDEX /*i*/ctd_user_defined ON /*_*/change_tag_def (ctd_user_defined);
729