1 CREATE TABLE /*_*/site_identifiers (
4 si_site INTEGER UNSIGNED NOT NULL,
5 PRIMARY KEY(si_type, si_key)
7 CREATE INDEX si_site ON /*_*/site_identifiers (si_site);
8 CREATE INDEX si_key ON /*_*/site_identifiers (si_key);
9 CREATE TABLE /*_*/updatelog (
10 ul_key VARCHAR(255) NOT NULL,
11 ul_value BLOB DEFAULT NULL,
14 CREATE TABLE /*_*/actor (
15 actor_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
16 actor_user INTEGER UNSIGNED DEFAULT NULL,
17 actor_name BLOB NOT NULL
19 CREATE UNIQUE INDEX actor_user ON /*_*/actor (actor_user);
20 CREATE UNIQUE INDEX actor_name ON /*_*/actor (actor_name);
21 CREATE TABLE /*_*/user_former_groups (
22 ufg_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
23 ufg_group BLOB DEFAULT '' NOT NULL,
24 PRIMARY KEY(ufg_user, ufg_group)
26 CREATE TABLE /*_*/bot_passwords (
27 bp_user INTEGER UNSIGNED NOT NULL,
28 bp_app_id BLOB NOT NULL,
29 bp_password BLOB NOT NULL,
30 bp_token BLOB DEFAULT '' NOT NULL,
31 bp_restrictions BLOB NOT NULL,
32 bp_grants BLOB NOT NULL,
33 PRIMARY KEY(bp_user, bp_app_id)
35 CREATE TABLE /*_*/comment (
36 comment_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
37 comment_hash INTEGER NOT NULL, comment_text BLOB NOT NULL,
38 comment_data BLOB DEFAULT NULL
40 CREATE INDEX comment_hash ON /*_*/comment (comment_hash);
41 CREATE TABLE /*_*/slots (
42 slot_revision_id BIGINT UNSIGNED NOT NULL,
43 slot_role_id SMALLINT UNSIGNED NOT NULL,
44 slot_content_id BIGINT UNSIGNED NOT NULL,
45 slot_origin BIGINT UNSIGNED NOT NULL,
46 PRIMARY KEY(slot_revision_id, slot_role_id)
48 CREATE INDEX slot_revision_origin_role ON /*_*/slots (
49 slot_revision_id, slot_origin, slot_role_id
51 CREATE TABLE /*_*/site_stats (
52 ss_row_id INTEGER UNSIGNED NOT NULL,
53 ss_total_edits BIGINT UNSIGNED DEFAULT NULL,
54 ss_good_articles BIGINT UNSIGNED DEFAULT NULL,
55 ss_total_pages BIGINT UNSIGNED DEFAULT NULL,
56 ss_users BIGINT UNSIGNED DEFAULT NULL,
57 ss_active_users BIGINT UNSIGNED DEFAULT NULL,
58 ss_images BIGINT UNSIGNED DEFAULT NULL,
59 PRIMARY KEY(ss_row_id)
61 CREATE TABLE /*_*/user_properties (
62 up_user INTEGER UNSIGNED NOT NULL,
63 up_property BLOB NOT NULL,
64 up_value BLOB DEFAULT NULL,
65 PRIMARY KEY(up_user, up_property)
67 CREATE INDEX up_property ON /*_*/user_properties (up_property);
68 CREATE TABLE /*_*/log_search (
69 ls_field BLOB NOT NULL,
70 ls_value VARCHAR(255) NOT NULL,
71 ls_log_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
72 PRIMARY KEY(ls_field, ls_value, ls_log_id)
74 CREATE INDEX ls_log_id ON /*_*/log_search (ls_log_id);
75 CREATE TABLE /*_*/change_tag (
76 ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
77 ct_rc_id INTEGER UNSIGNED DEFAULT NULL,
78 ct_log_id INTEGER UNSIGNED DEFAULT NULL,
79 ct_rev_id INTEGER UNSIGNED DEFAULT NULL,
80 ct_params BLOB DEFAULT NULL, ct_tag_id INTEGER UNSIGNED NOT NULL
82 CREATE UNIQUE INDEX ct_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id);
83 CREATE UNIQUE INDEX ct_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id);
84 CREATE UNIQUE INDEX ct_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id);
85 CREATE INDEX ct_tag_id_id ON /*_*/change_tag (
86 ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id
88 CREATE TABLE /*_*/content (
89 content_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
90 content_size INTEGER UNSIGNED NOT NULL,
91 content_sha1 BLOB NOT NULL, content_model SMALLINT UNSIGNED NOT NULL,
92 content_address BLOB NOT NULL
94 CREATE TABLE /*_*/l10n_cache (
95 lc_lang BLOB NOT NULL,
96 lc_key VARCHAR(255) NOT NULL,
97 lc_value BLOB NOT NULL,
98 PRIMARY KEY(lc_lang, lc_key)
100 CREATE TABLE /*_*/module_deps (
101 md_module BLOB NOT NULL,
102 md_skin BLOB NOT NULL,
103 md_deps BLOB NOT NULL,
104 PRIMARY KEY(md_module, md_skin)
106 CREATE TABLE /*_*/redirect (
107 rd_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
108 rd_namespace INTEGER DEFAULT 0 NOT NULL,
109 rd_title BLOB DEFAULT '' NOT NULL,
110 rd_interwiki VARCHAR(32) DEFAULT NULL,
111 rd_fragment BLOB DEFAULT NULL,
114 CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace, rd_title, rd_from);
115 CREATE TABLE /*_*/pagelinks (
116 pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
117 pl_namespace INTEGER DEFAULT 0 NOT NULL,
118 pl_title BLOB DEFAULT '' NOT NULL,
119 pl_from_namespace INTEGER DEFAULT 0 NOT NULL,
120 PRIMARY KEY(pl_from, pl_namespace, pl_title)
122 CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
123 CREATE INDEX pl_backlinks_namespace ON /*_*/pagelinks (
124 pl_from_namespace, pl_namespace,
127 CREATE TABLE /*_*/templatelinks (
128 tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
129 tl_target_id BIGINT UNSIGNED NOT NULL,
130 tl_from_namespace INTEGER DEFAULT 0 NOT NULL,
131 PRIMARY KEY(tl_from, tl_target_id)
133 CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
134 CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks (
135 tl_from_namespace, tl_target_id,
138 CREATE TABLE /*_*/imagelinks (
139 il_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
140 il_to BLOB DEFAULT '' NOT NULL,
141 il_from_namespace INTEGER DEFAULT 0 NOT NULL,
142 PRIMARY KEY(il_from, il_to)
144 CREATE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
145 CREATE INDEX il_backlinks_namespace ON /*_*/imagelinks (
146 il_from_namespace, il_to, il_from
148 CREATE TABLE /*_*/langlinks (
149 ll_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
150 ll_lang BLOB DEFAULT '' NOT NULL,
151 ll_title BLOB DEFAULT '' NOT NULL,
152 PRIMARY KEY(ll_from, ll_lang)
154 CREATE INDEX ll_lang ON /*_*/langlinks (ll_lang, ll_title);
155 CREATE TABLE /*_*/iwlinks (
156 iwl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
157 iwl_prefix BLOB DEFAULT '' NOT NULL,
158 iwl_title BLOB DEFAULT '' NOT NULL,
159 PRIMARY KEY(iwl_from, iwl_prefix, iwl_title)
161 CREATE INDEX iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
162 CREATE INDEX iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
163 CREATE TABLE /*_*/category (
164 cat_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
165 cat_title BLOB NOT NULL, cat_pages INTEGER DEFAULT 0 NOT NULL,
166 cat_subcats INTEGER DEFAULT 0 NOT NULL,
167 cat_files INTEGER DEFAULT 0 NOT NULL
169 CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title);
170 CREATE INDEX cat_pages ON /*_*/category (cat_pages);
171 CREATE TABLE /*_*/watchlist_expiry (
172 we_item INTEGER UNSIGNED NOT NULL,
173 we_expiry BLOB NOT NULL,
176 CREATE INDEX we_expiry ON /*_*/watchlist_expiry (we_expiry);
177 CREATE TABLE /*_*/change_tag_def (
178 ctd_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
179 ctd_name BLOB NOT NULL, ctd_user_defined SMALLINT NOT NULL,
180 ctd_count BIGINT UNSIGNED DEFAULT 0 NOT NULL
182 CREATE UNIQUE INDEX ctd_name ON /*_*/change_tag_def (ctd_name);
183 CREATE INDEX ctd_count ON /*_*/change_tag_def (ctd_count);
184 CREATE INDEX ctd_user_defined ON /*_*/change_tag_def (ctd_user_defined);
185 CREATE TABLE /*_*/ipblocks_restrictions (
186 ir_ipb_id INTEGER UNSIGNED NOT NULL,
187 ir_type SMALLINT NOT NULL,
188 ir_value INTEGER UNSIGNED NOT NULL,
189 PRIMARY KEY(ir_ipb_id, ir_type, ir_value)
191 CREATE INDEX ir_type_value ON /*_*/ipblocks_restrictions (ir_type, ir_value);
192 CREATE TABLE /*_*/querycache (
193 qc_type BLOB NOT NULL, qc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
194 qc_namespace INTEGER DEFAULT 0 NOT NULL,
195 qc_title BLOB DEFAULT '' NOT NULL
197 CREATE INDEX qc_type ON /*_*/querycache (qc_type, qc_value);
198 CREATE TABLE /*_*/querycachetwo (
199 qcc_type BLOB NOT NULL, qcc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
200 qcc_namespace INTEGER DEFAULT 0 NOT NULL,
201 qcc_title BLOB DEFAULT '' NOT NULL,
202 qcc_namespacetwo INTEGER DEFAULT 0 NOT NULL,
203 qcc_titletwo BLOB DEFAULT '' NOT NULL
205 CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type, qcc_value);
206 CREATE INDEX qcc_title ON /*_*/querycachetwo (
207 qcc_type, qcc_namespace, qcc_title
209 CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (
210 qcc_type, qcc_namespacetwo, qcc_titletwo
212 CREATE TABLE /*_*/page_restrictions (
213 pr_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
214 pr_page INTEGER UNSIGNED NOT NULL,
215 pr_type BLOB NOT NULL, pr_level BLOB NOT NULL,
216 pr_cascade SMALLINT NOT NULL, pr_expiry BLOB DEFAULT NULL
218 CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page, pr_type);
219 CREATE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type, pr_level);
220 CREATE INDEX pr_level ON /*_*/page_restrictions (pr_level);
221 CREATE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);
222 CREATE TABLE /*_*/user_groups (
223 ug_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
224 ug_group BLOB DEFAULT '' NOT NULL,
225 ug_expiry BLOB DEFAULT NULL,
226 PRIMARY KEY(ug_user, ug_group)
228 CREATE INDEX ug_group ON /*_*/user_groups (ug_group);
229 CREATE INDEX ug_expiry ON /*_*/user_groups (ug_expiry);
230 CREATE TABLE /*_*/querycache_info (
231 qci_type BLOB DEFAULT '' NOT NULL,
232 qci_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
233 PRIMARY KEY(qci_type)
235 CREATE TABLE /*_*/watchlist (
236 wl_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
237 wl_user INTEGER UNSIGNED NOT NULL,
238 wl_namespace INTEGER DEFAULT 0 NOT NULL,
239 wl_title BLOB DEFAULT '' NOT NULL, wl_notificationtimestamp BLOB DEFAULT NULL
241 CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
242 CREATE INDEX wl_namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
243 CREATE INDEX wl_user_notificationtimestamp ON /*_*/watchlist (
244 wl_user, wl_notificationtimestamp
246 CREATE TABLE /*_*/sites (
247 site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
248 site_global_key BLOB NOT NULL,
249 site_type BLOB NOT NULL,
250 site_group BLOB NOT NULL,
251 site_source BLOB NOT NULL,
252 site_language BLOB NOT NULL,
253 site_protocol BLOB NOT NULL,
254 site_domain VARCHAR(255) NOT NULL,
255 site_data BLOB NOT NULL,
256 site_forward SMALLINT NOT NULL,
257 site_config BLOB NOT NULL
259 CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);
260 CREATE INDEX site_type ON /*_*/sites (site_type);
261 CREATE INDEX site_group ON /*_*/sites (site_group);
262 CREATE INDEX site_source ON /*_*/sites (site_source);
263 CREATE INDEX site_language ON /*_*/sites (site_language);
264 CREATE INDEX site_protocol ON /*_*/sites (site_protocol);
265 CREATE INDEX site_domain ON /*_*/sites (site_domain);
266 CREATE INDEX site_forward ON /*_*/sites (site_forward);
267 CREATE TABLE /*_*/user_newtalk (
268 user_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
269 user_ip BLOB DEFAULT '' NOT NULL, user_last_timestamp BLOB DEFAULT NULL
271 CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id);
272 CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip);
273 CREATE TABLE /*_*/interwiki (
274 iw_prefix VARCHAR(32) NOT NULL,
275 iw_url BLOB NOT NULL,
276 iw_api BLOB NOT NULL,
277 iw_wikiid VARCHAR(64) NOT NULL,
278 iw_local SMALLINT NOT NULL,
279 iw_trans SMALLINT DEFAULT 0 NOT NULL,
280 PRIMARY KEY(iw_prefix)
282 CREATE TABLE /*_*/protected_titles (
283 pt_namespace INTEGER NOT NULL,
284 pt_title BLOB NOT NULL,
285 pt_user INTEGER UNSIGNED NOT NULL,
286 pt_reason_id BIGINT UNSIGNED NOT NULL,
287 pt_timestamp BLOB NOT NULL,
288 pt_expiry BLOB NOT NULL,
289 pt_create_perm BLOB NOT NULL,
290 PRIMARY KEY(pt_namespace, pt_title)
292 CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp);
293 CREATE TABLE /*_*/externallinks (
294 el_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
295 el_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
296 el_to BLOB NOT NULL, el_index BLOB NOT NULL,
297 el_index_60 BLOB NOT NULL, el_to_domain_index BLOB DEFAULT '' NOT NULL,
298 el_to_path BLOB DEFAULT NULL
300 CREATE INDEX el_from ON /*_*/externallinks (el_from);
301 CREATE INDEX el_to ON /*_*/externallinks (el_to, el_from);
302 CREATE INDEX el_index ON /*_*/externallinks (el_index);
303 CREATE INDEX el_index_60 ON /*_*/externallinks (el_index_60, el_id);
304 CREATE INDEX el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
305 CREATE INDEX el_to_domain_index_to_path ON /*_*/externallinks (el_to_domain_index, el_to_path);
306 CREATE TABLE /*_*/ip_changes (
307 ipc_rev_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
308 ipc_rev_timestamp BLOB NOT NULL,
309 ipc_hex BLOB DEFAULT '' NOT NULL,
310 PRIMARY KEY(ipc_rev_id)
312 CREATE INDEX ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
313 CREATE INDEX ipc_hex_time ON /*_*/ip_changes (ipc_hex, ipc_rev_timestamp);
314 CREATE TABLE /*_*/revision_comment_temp (
315 revcomment_rev INTEGER UNSIGNED NOT NULL,
316 revcomment_comment_id BIGINT UNSIGNED NOT NULL,
318 revcomment_rev, revcomment_comment_id
321 CREATE UNIQUE INDEX revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
322 CREATE TABLE /*_*/page_props (
323 pp_page INTEGER UNSIGNED NOT NULL,
324 pp_propname BLOB NOT NULL,
325 pp_value BLOB NOT NULL,
326 pp_sortkey DOUBLE PRECISION DEFAULT NULL,
327 PRIMARY KEY(pp_page, pp_propname)
329 CREATE UNIQUE INDEX pp_propname_page ON /*_*/page_props (pp_propname, pp_page);
330 CREATE UNIQUE INDEX pp_propname_sortkey_page ON /*_*/page_props (pp_propname, pp_sortkey, pp_page);
331 CREATE TABLE /*_*/job (
332 job_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
333 job_cmd BLOB DEFAULT '' NOT NULL, job_namespace INTEGER NOT NULL,
334 job_title BLOB NOT NULL, job_timestamp BLOB DEFAULT NULL,
335 job_params BLOB NOT NULL, job_random INTEGER UNSIGNED DEFAULT 0 NOT NULL,
336 job_attempts INTEGER UNSIGNED DEFAULT 0 NOT NULL,
337 job_token BLOB DEFAULT '' NOT NULL,
338 job_token_timestamp BLOB DEFAULT NULL,
339 job_sha1 BLOB DEFAULT '' NOT NULL
341 CREATE INDEX job_sha1 ON /*_*/job (job_sha1);
342 CREATE INDEX job_cmd_token ON /*_*/job (job_cmd, job_token, job_random);
343 CREATE INDEX job_cmd_token_id ON /*_*/job (job_cmd, job_token, job_id);
344 CREATE INDEX job_cmd ON /*_*/job (
345 job_cmd, job_namespace, job_title,
348 CREATE INDEX job_timestamp ON /*_*/job (job_timestamp);
349 CREATE TABLE /*_*/slot_roles (
350 role_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
351 role_name BLOB NOT NULL
353 CREATE UNIQUE INDEX role_name ON /*_*/slot_roles (role_name);
354 CREATE TABLE /*_*/content_models (
355 model_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
356 model_name BLOB NOT NULL
358 CREATE UNIQUE INDEX model_name ON /*_*/content_models (model_name);
359 CREATE TABLE /*_*/categorylinks (
360 cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
361 cl_to BLOB DEFAULT '' NOT NULL,
362 cl_sortkey BLOB DEFAULT '' NOT NULL,
363 cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
364 cl_timestamp DATETIME NOT NULL,
365 cl_collation BLOB DEFAULT '' NOT NULL,
366 cl_type TEXT DEFAULT 'page' NOT NULL,
367 PRIMARY KEY(cl_from, cl_to)
369 CREATE INDEX cl_sortkey ON /*_*/categorylinks (
370 cl_to, cl_type, cl_sortkey, cl_from
372 CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
373 CREATE INDEX cl_collation_ext ON /*_*/categorylinks (
374 cl_collation, cl_to, cl_type, cl_from
376 CREATE TABLE /*_*/logging (
377 log_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
378 log_type BLOB DEFAULT '' NOT NULL, log_action BLOB DEFAULT '' NOT NULL,
379 log_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
380 log_actor BIGINT UNSIGNED NOT NULL,
381 log_namespace INTEGER DEFAULT 0 NOT NULL,
382 log_title BLOB DEFAULT '' NOT NULL,
383 log_page INTEGER UNSIGNED DEFAULT NULL,
384 log_comment_id BIGINT UNSIGNED NOT NULL,
385 log_params BLOB NOT NULL, log_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL
387 CREATE INDEX log_type_time ON /*_*/logging (log_type, log_timestamp);
388 CREATE INDEX log_actor_time ON /*_*/logging (log_actor, log_timestamp);
389 CREATE INDEX log_page_time ON /*_*/logging (
390 log_namespace, log_title, log_timestamp
392 CREATE INDEX log_times ON /*_*/logging (log_timestamp);
393 CREATE INDEX log_actor_type_time ON /*_*/logging (
394 log_actor, log_type, log_timestamp
396 CREATE INDEX log_page_id_time ON /*_*/logging (log_page, log_timestamp);
397 CREATE INDEX log_type_action ON /*_*/logging (
398 log_type, log_action, log_timestamp
400 CREATE TABLE /*_*/uploadstash (
401 us_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
402 us_user INTEGER UNSIGNED NOT NULL,
403 us_key VARCHAR(255) NOT NULL,
404 us_orig_path VARCHAR(255) NOT NULL,
405 us_path VARCHAR(255) NOT NULL,
406 us_source_type VARCHAR(50) DEFAULT NULL,
407 us_timestamp BLOB NOT NULL,
408 us_status VARCHAR(50) NOT NULL,
409 us_chunk_inx INTEGER UNSIGNED DEFAULT NULL,
410 us_props BLOB DEFAULT NULL,
411 us_size INTEGER UNSIGNED NOT NULL,
412 us_sha1 VARCHAR(31) NOT NULL,
413 us_mime VARCHAR(255) DEFAULT NULL,
414 us_media_type TEXT DEFAULT NULL,
415 us_image_width INTEGER UNSIGNED DEFAULT NULL,
416 us_image_height INTEGER UNSIGNED DEFAULT NULL,
417 us_image_bits SMALLINT UNSIGNED DEFAULT NULL
419 CREATE INDEX us_user ON /*_*/uploadstash (us_user);
420 CREATE UNIQUE INDEX us_key ON /*_*/uploadstash (us_key);
421 CREATE INDEX us_timestamp ON /*_*/uploadstash (us_timestamp);
422 CREATE TABLE /*_*/filearchive (
423 fa_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
424 fa_name BLOB DEFAULT '' NOT NULL, fa_archive_name BLOB DEFAULT '',
425 fa_storage_group BLOB DEFAULT NULL,
426 fa_storage_key BLOB DEFAULT '', fa_deleted_user INTEGER DEFAULT NULL,
427 fa_deleted_timestamp BLOB DEFAULT NULL,
428 fa_deleted_reason_id BIGINT UNSIGNED NOT NULL,
429 fa_size INTEGER UNSIGNED DEFAULT 0,
430 fa_width INTEGER DEFAULT 0, fa_height INTEGER DEFAULT 0,
431 fa_metadata BLOB DEFAULT NULL, fa_bits INTEGER DEFAULT 0,
432 fa_media_type TEXT DEFAULT NULL, fa_major_mime TEXT DEFAULT 'unknown',
433 fa_minor_mime BLOB DEFAULT 'unknown',
434 fa_description_id BIGINT UNSIGNED NOT NULL,
435 fa_actor BIGINT UNSIGNED NOT NULL,
436 fa_timestamp BLOB DEFAULT NULL, fa_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
437 fa_sha1 BLOB DEFAULT '' NOT NULL
439 CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
440 CREATE INDEX fa_storage_group ON /*_*/filearchive (
441 fa_storage_group, fa_storage_key
443 CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
444 CREATE INDEX fa_actor_timestamp ON /*_*/filearchive (fa_actor, fa_timestamp);
445 CREATE INDEX fa_sha1 ON /*_*/filearchive (fa_sha1);
446 CREATE TABLE /*_*/text (
447 old_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
448 old_text BLOB NOT NULL, old_flags BLOB NOT NULL
450 CREATE TABLE /*_*/oldimage (
451 oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL,
452 oi_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
453 oi_width INTEGER DEFAULT 0 NOT NULL,
454 oi_height INTEGER DEFAULT 0 NOT NULL,
455 oi_bits INTEGER DEFAULT 0 NOT NULL,
456 oi_description_id BIGINT UNSIGNED NOT NULL,
457 oi_actor BIGINT UNSIGNED NOT NULL,
458 oi_timestamp BLOB NOT NULL, oi_metadata BLOB NOT NULL,
459 oi_media_type TEXT DEFAULT NULL, oi_major_mime TEXT DEFAULT 'unknown' NOT NULL,
460 oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
461 oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
462 oi_sha1 BLOB DEFAULT '' NOT NULL
464 CREATE INDEX oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
465 CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
466 CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
467 CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
468 CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp);
469 CREATE TABLE /*_*/objectcache (
470 keyname BLOB DEFAULT '' NOT NULL,
471 value BLOB DEFAULT NULL,
472 exptime BLOB NOT NULL,
473 modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL,
474 flags INTEGER UNSIGNED DEFAULT NULL,
477 CREATE INDEX exptime ON /*_*/objectcache (exptime);
478 CREATE TABLE /*_*/ipblocks (
479 ipb_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
480 ipb_address BLOB NOT NULL, ipb_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
481 ipb_by_actor BIGINT UNSIGNED NOT NULL,
482 ipb_reason_id BIGINT UNSIGNED NOT NULL,
483 ipb_timestamp BLOB NOT NULL, ipb_auto SMALLINT DEFAULT 0 NOT NULL,
484 ipb_anon_only SMALLINT DEFAULT 0 NOT NULL,
485 ipb_create_account SMALLINT DEFAULT 1 NOT NULL,
486 ipb_enable_autoblock SMALLINT DEFAULT 1 NOT NULL,
487 ipb_expiry BLOB NOT NULL, ipb_range_start BLOB NOT NULL,
488 ipb_range_end BLOB NOT NULL, ipb_deleted SMALLINT DEFAULT 0 NOT NULL,
489 ipb_block_email SMALLINT DEFAULT 0 NOT NULL,
490 ipb_allow_usertalk SMALLINT DEFAULT 0 NOT NULL,
491 ipb_parent_block_id INTEGER UNSIGNED DEFAULT NULL,
492 ipb_sitewide SMALLINT DEFAULT 1 NOT NULL
494 CREATE UNIQUE INDEX ipb_address_unique ON /*_*/ipblocks (ipb_address, ipb_user, ipb_auto);
495 CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user);
496 CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start, ipb_range_end);
497 CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
498 CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry);
499 CREATE INDEX ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
500 CREATE TABLE /*_*/image (
501 img_name BLOB DEFAULT '' NOT NULL,
502 img_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
503 img_width INTEGER DEFAULT 0 NOT NULL,
504 img_height INTEGER DEFAULT 0 NOT NULL,
505 img_metadata BLOB NOT NULL,
506 img_bits INTEGER DEFAULT 0 NOT NULL,
507 img_media_type TEXT DEFAULT NULL,
508 img_major_mime TEXT DEFAULT 'unknown' NOT NULL,
509 img_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
510 img_description_id BIGINT UNSIGNED NOT NULL,
511 img_actor BIGINT UNSIGNED NOT NULL,
512 img_timestamp BLOB NOT NULL,
513 img_sha1 BLOB DEFAULT '' NOT NULL,
514 PRIMARY KEY(img_name)
516 CREATE INDEX img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
517 CREATE INDEX img_size ON /*_*/image (img_size);
518 CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
519 CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
520 CREATE INDEX img_media_mime ON /*_*/image (
521 img_media_type, img_major_mime, img_minor_mime
523 CREATE TABLE /*_*/recentchanges (
524 rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
525 rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
526 rc_namespace INTEGER DEFAULT 0 NOT NULL,
527 rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
528 rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
529 rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
530 rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
531 rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
532 rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
533 rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
534 rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
535 rc_source BLOB DEFAULT '' NOT NULL,
536 rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
537 rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
538 rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
539 rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
540 rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
541 rc_params BLOB DEFAULT NULL
543 CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
544 CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
545 rc_namespace, rc_title, rc_timestamp
547 CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
548 CREATE INDEX rc_new_name_timestamp ON /*_*/recentchanges (
549 rc_new, rc_namespace, rc_timestamp
551 CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
552 CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
553 CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
554 CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
555 rc_namespace, rc_type, rc_patrolled,
558 CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
559 CREATE TABLE /*_*/archive (
560 ar_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
561 ar_namespace INTEGER DEFAULT 0 NOT NULL,
562 ar_title BLOB DEFAULT '' NOT NULL, ar_comment_id BIGINT UNSIGNED NOT NULL,
563 ar_actor BIGINT UNSIGNED NOT NULL,
564 ar_timestamp BLOB NOT NULL, ar_minor_edit SMALLINT DEFAULT 0 NOT NULL,
565 ar_rev_id INTEGER UNSIGNED NOT NULL,
566 ar_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
567 ar_len INTEGER UNSIGNED DEFAULT NULL,
568 ar_page_id INTEGER UNSIGNED DEFAULT NULL,
569 ar_parent_id INTEGER UNSIGNED DEFAULT NULL,
570 ar_sha1 BLOB DEFAULT '' NOT NULL
572 CREATE INDEX ar_name_title_timestamp ON /*_*/archive (
573 ar_namespace, ar_title, ar_timestamp
575 CREATE INDEX ar_actor_timestamp ON /*_*/archive (ar_actor, ar_timestamp);
576 CREATE UNIQUE INDEX ar_revid_uniq ON /*_*/archive (ar_rev_id);
577 CREATE TABLE /*_*/page (
578 page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
579 page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL,
580 page_is_redirect SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
581 page_is_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
582 page_random DOUBLE PRECISION NOT NULL,
583 page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL,
584 page_latest INTEGER UNSIGNED NOT NULL,
585 page_len INTEGER UNSIGNED NOT NULL,
586 page_content_model BLOB DEFAULT NULL,
587 page_lang BLOB DEFAULT NULL
589 CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
590 CREATE INDEX page_random ON /*_*/page (page_random);
591 CREATE INDEX page_len ON /*_*/page (page_len);
592 CREATE INDEX page_redirect_namespace_len ON /*_*/page (
593 page_is_redirect, page_namespace,
596 CREATE TABLE /*_*/user (
597 user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
598 user_name BLOB DEFAULT '' NOT NULL,
599 user_real_name BLOB DEFAULT '' NOT NULL,
600 user_password BLOB NOT NULL, user_newpassword BLOB NOT NULL,
601 user_newpass_time BLOB DEFAULT NULL,
602 user_email CLOB NOT NULL, user_touched BLOB NOT NULL,
603 user_token BLOB DEFAULT '' NOT NULL,
604 user_email_authenticated BLOB DEFAULT NULL,
605 user_email_token BLOB DEFAULT NULL,
606 user_email_token_expires BLOB DEFAULT NULL,
607 user_registration BLOB DEFAULT NULL,
608 user_editcount INTEGER UNSIGNED DEFAULT NULL,
609 user_password_expires BLOB DEFAULT NULL
611 CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
612 CREATE INDEX user_email_token ON /*_*/user (user_email_token);
613 CREATE INDEX user_email ON /*_*/user (user_email);
614 CREATE TABLE /*_*/user_autocreate_serial (
615 uas_shard INTEGER UNSIGNED NOT NULL,
616 uas_value INTEGER UNSIGNED NOT NULL,
617 PRIMARY KEY(uas_shard)
619 CREATE TABLE /*_*/revision (
620 rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
621 rev_page INTEGER UNSIGNED NOT NULL,
622 rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL,
623 rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL,
624 rev_timestamp BLOB NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
625 rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
626 rev_len INTEGER UNSIGNED DEFAULT NULL,
627 rev_parent_id INTEGER UNSIGNED DEFAULT NULL,
628 rev_sha1 BLOB DEFAULT '' NOT NULL
630 CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
631 CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
632 CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
633 CREATE INDEX rev_page_actor_timestamp ON /*_*/revision (
634 rev_page, rev_actor, rev_timestamp
636 CREATE TABLE /*_*/searchindex (
637 si_page INTEGER UNSIGNED NOT NULL,
638 si_title VARCHAR(255) DEFAULT '' NOT NULL,
639 si_text CLOB NOT NULL
641 CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page);
642 CREATE INDEX si_title ON /*_*/searchindex (si_title);
643 CREATE INDEX si_text ON /*_*/searchindex (si_text);
644 CREATE TABLE /*_*/linktarget (
645 lt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
646 lt_namespace INTEGER NOT NULL, lt_title BLOB NOT NULL
648 CREATE UNIQUE INDEX lt_namespace_title ON /*_*/linktarget (lt_namespace, lt_title);