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
299 CREATE INDEX el_from ON /*_*/externallinks (el_from, el_to);
300 CREATE INDEX el_to ON /*_*/externallinks (el_to, el_from);
301 CREATE INDEX el_index ON /*_*/externallinks (el_index);
302 CREATE INDEX el_index_60 ON /*_*/externallinks (el_index_60, el_id);
303 CREATE INDEX el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
304 CREATE TABLE /*_*/ip_changes (
305 ipc_rev_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
306 ipc_rev_timestamp BLOB NOT NULL,
307 ipc_hex BLOB DEFAULT '' NOT NULL,
308 PRIMARY KEY(ipc_rev_id)
310 CREATE INDEX ipc_rev_timestamp ON /*_*/ip_changes (ipc_rev_timestamp);
311 CREATE INDEX ipc_hex_time ON /*_*/ip_changes (ipc_hex, ipc_rev_timestamp);
312 CREATE TABLE /*_*/revision_comment_temp (
313 revcomment_rev INTEGER UNSIGNED NOT NULL,
314 revcomment_comment_id BIGINT UNSIGNED NOT NULL,
316 revcomment_rev, revcomment_comment_id
319 CREATE UNIQUE INDEX revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev);
320 CREATE TABLE /*_*/page_props (
321 pp_page INTEGER UNSIGNED NOT NULL,
322 pp_propname BLOB NOT NULL,
323 pp_value BLOB NOT NULL,
324 pp_sortkey DOUBLE PRECISION DEFAULT NULL,
325 PRIMARY KEY(pp_page, pp_propname)
327 CREATE UNIQUE INDEX pp_propname_page ON /*_*/page_props (pp_propname, pp_page);
328 CREATE UNIQUE INDEX pp_propname_sortkey_page ON /*_*/page_props (pp_propname, pp_sortkey, pp_page);
329 CREATE TABLE /*_*/job (
330 job_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
331 job_cmd BLOB DEFAULT '' NOT NULL, job_namespace INTEGER NOT NULL,
332 job_title BLOB NOT NULL, job_timestamp BLOB DEFAULT NULL,
333 job_params BLOB NOT NULL, job_random INTEGER UNSIGNED DEFAULT 0 NOT NULL,
334 job_attempts INTEGER UNSIGNED DEFAULT 0 NOT NULL,
335 job_token BLOB DEFAULT '' NOT NULL,
336 job_token_timestamp BLOB DEFAULT NULL,
337 job_sha1 BLOB DEFAULT '' NOT NULL
339 CREATE INDEX job_sha1 ON /*_*/job (job_sha1);
340 CREATE INDEX job_cmd_token ON /*_*/job (job_cmd, job_token, job_random);
341 CREATE INDEX job_cmd_token_id ON /*_*/job (job_cmd, job_token, job_id);
342 CREATE INDEX job_cmd ON /*_*/job (
343 job_cmd, job_namespace, job_title,
346 CREATE INDEX job_timestamp ON /*_*/job (job_timestamp);
347 CREATE TABLE /*_*/slot_roles (
348 role_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
349 role_name BLOB NOT NULL
351 CREATE UNIQUE INDEX role_name ON /*_*/slot_roles (role_name);
352 CREATE TABLE /*_*/content_models (
353 model_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
354 model_name BLOB NOT NULL
356 CREATE UNIQUE INDEX model_name ON /*_*/content_models (model_name);
357 CREATE TABLE /*_*/categorylinks (
358 cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
359 cl_to BLOB DEFAULT '' NOT NULL,
360 cl_sortkey BLOB DEFAULT '' NOT NULL,
361 cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
362 cl_timestamp DATETIME NOT NULL,
363 cl_collation BLOB DEFAULT '' NOT NULL,
364 cl_type TEXT DEFAULT 'page' NOT NULL,
365 PRIMARY KEY(cl_from, cl_to)
367 CREATE INDEX cl_sortkey ON /*_*/categorylinks (
368 cl_to, cl_type, cl_sortkey, cl_from
370 CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
371 CREATE INDEX cl_collation_ext ON /*_*/categorylinks (
372 cl_collation, cl_to, cl_type, cl_from
374 CREATE TABLE /*_*/logging (
375 log_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
376 log_type BLOB DEFAULT '' NOT NULL, log_action BLOB DEFAULT '' NOT NULL,
377 log_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
378 log_actor BIGINT UNSIGNED NOT NULL,
379 log_namespace INTEGER DEFAULT 0 NOT NULL,
380 log_title BLOB DEFAULT '' NOT NULL,
381 log_page INTEGER UNSIGNED DEFAULT NULL,
382 log_comment_id BIGINT UNSIGNED NOT NULL,
383 log_params BLOB NOT NULL, log_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL
385 CREATE INDEX log_type_time ON /*_*/logging (log_type, log_timestamp);
386 CREATE INDEX log_actor_time ON /*_*/logging (log_actor, log_timestamp);
387 CREATE INDEX log_page_time ON /*_*/logging (
388 log_namespace, log_title, log_timestamp
390 CREATE INDEX log_times ON /*_*/logging (log_timestamp);
391 CREATE INDEX log_actor_type_time ON /*_*/logging (
392 log_actor, log_type, log_timestamp
394 CREATE INDEX log_page_id_time ON /*_*/logging (log_page, log_timestamp);
395 CREATE INDEX log_type_action ON /*_*/logging (
396 log_type, log_action, log_timestamp
398 CREATE TABLE /*_*/uploadstash (
399 us_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
400 us_user INTEGER UNSIGNED NOT NULL,
401 us_key VARCHAR(255) NOT NULL,
402 us_orig_path VARCHAR(255) NOT NULL,
403 us_path VARCHAR(255) NOT NULL,
404 us_source_type VARCHAR(50) DEFAULT NULL,
405 us_timestamp BLOB NOT NULL,
406 us_status VARCHAR(50) NOT NULL,
407 us_chunk_inx INTEGER UNSIGNED DEFAULT NULL,
408 us_props BLOB DEFAULT NULL,
409 us_size INTEGER UNSIGNED NOT NULL,
410 us_sha1 VARCHAR(31) NOT NULL,
411 us_mime VARCHAR(255) DEFAULT NULL,
412 us_media_type TEXT DEFAULT NULL,
413 us_image_width INTEGER UNSIGNED DEFAULT NULL,
414 us_image_height INTEGER UNSIGNED DEFAULT NULL,
415 us_image_bits SMALLINT UNSIGNED DEFAULT NULL
417 CREATE INDEX us_user ON /*_*/uploadstash (us_user);
418 CREATE UNIQUE INDEX us_key ON /*_*/uploadstash (us_key);
419 CREATE INDEX us_timestamp ON /*_*/uploadstash (us_timestamp);
420 CREATE TABLE /*_*/filearchive (
421 fa_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
422 fa_name BLOB DEFAULT '' NOT NULL, fa_archive_name BLOB DEFAULT '',
423 fa_storage_group BLOB DEFAULT NULL,
424 fa_storage_key BLOB DEFAULT '', fa_deleted_user INTEGER DEFAULT NULL,
425 fa_deleted_timestamp BLOB DEFAULT NULL,
426 fa_deleted_reason_id BIGINT UNSIGNED NOT NULL,
427 fa_size INTEGER UNSIGNED DEFAULT 0,
428 fa_width INTEGER DEFAULT 0, fa_height INTEGER DEFAULT 0,
429 fa_metadata BLOB DEFAULT NULL, fa_bits INTEGER DEFAULT 0,
430 fa_media_type TEXT DEFAULT NULL, fa_major_mime TEXT DEFAULT 'unknown',
431 fa_minor_mime BLOB DEFAULT 'unknown',
432 fa_description_id BIGINT UNSIGNED NOT NULL,
433 fa_actor BIGINT UNSIGNED NOT NULL,
434 fa_timestamp BLOB DEFAULT NULL, fa_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
435 fa_sha1 BLOB DEFAULT '' NOT NULL
437 CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
438 CREATE INDEX fa_storage_group ON /*_*/filearchive (
439 fa_storage_group, fa_storage_key
441 CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
442 CREATE INDEX fa_actor_timestamp ON /*_*/filearchive (fa_actor, fa_timestamp);
443 CREATE INDEX fa_sha1 ON /*_*/filearchive (fa_sha1);
444 CREATE TABLE /*_*/text (
445 old_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
446 old_text BLOB NOT NULL, old_flags BLOB NOT NULL
448 CREATE TABLE /*_*/oldimage (
449 oi_name BLOB DEFAULT '' NOT NULL, oi_archive_name BLOB DEFAULT '' NOT NULL,
450 oi_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
451 oi_width INTEGER DEFAULT 0 NOT NULL,
452 oi_height INTEGER DEFAULT 0 NOT NULL,
453 oi_bits INTEGER DEFAULT 0 NOT NULL,
454 oi_description_id BIGINT UNSIGNED NOT NULL,
455 oi_actor BIGINT UNSIGNED NOT NULL,
456 oi_timestamp BLOB NOT NULL, oi_metadata BLOB NOT NULL,
457 oi_media_type TEXT DEFAULT NULL, oi_major_mime TEXT DEFAULT 'unknown' NOT NULL,
458 oi_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
459 oi_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
460 oi_sha1 BLOB DEFAULT '' NOT NULL
462 CREATE INDEX oi_actor_timestamp ON /*_*/oldimage (oi_actor, oi_timestamp);
463 CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name, oi_timestamp);
464 CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name, oi_archive_name);
465 CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
466 CREATE INDEX oi_timestamp ON /*_*/oldimage (oi_timestamp);
467 CREATE TABLE /*_*/objectcache (
468 keyname BLOB DEFAULT '' NOT NULL,
469 value BLOB DEFAULT NULL,
470 exptime BLOB NOT NULL,
471 modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL,
472 flags INTEGER UNSIGNED DEFAULT NULL,
475 CREATE INDEX exptime ON /*_*/objectcache (exptime);
476 CREATE TABLE /*_*/ipblocks (
477 ipb_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
478 ipb_address BLOB NOT NULL, ipb_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
479 ipb_by_actor BIGINT UNSIGNED NOT NULL,
480 ipb_reason_id BIGINT UNSIGNED NOT NULL,
481 ipb_timestamp BLOB NOT NULL, ipb_auto SMALLINT DEFAULT 0 NOT NULL,
482 ipb_anon_only SMALLINT DEFAULT 0 NOT NULL,
483 ipb_create_account SMALLINT DEFAULT 1 NOT NULL,
484 ipb_enable_autoblock SMALLINT DEFAULT 1 NOT NULL,
485 ipb_expiry BLOB NOT NULL, ipb_range_start BLOB NOT NULL,
486 ipb_range_end BLOB NOT NULL, ipb_deleted SMALLINT DEFAULT 0 NOT NULL,
487 ipb_block_email SMALLINT DEFAULT 0 NOT NULL,
488 ipb_allow_usertalk SMALLINT DEFAULT 0 NOT NULL,
489 ipb_parent_block_id INTEGER UNSIGNED DEFAULT NULL,
490 ipb_sitewide SMALLINT DEFAULT 1 NOT NULL
492 CREATE UNIQUE INDEX ipb_address_unique ON /*_*/ipblocks (ipb_address, ipb_user, ipb_auto);
493 CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user);
494 CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start, ipb_range_end);
495 CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
496 CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry);
497 CREATE INDEX ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
498 CREATE TABLE /*_*/image (
499 img_name BLOB DEFAULT '' NOT NULL,
500 img_size INTEGER UNSIGNED DEFAULT 0 NOT NULL,
501 img_width INTEGER DEFAULT 0 NOT NULL,
502 img_height INTEGER DEFAULT 0 NOT NULL,
503 img_metadata BLOB NOT NULL,
504 img_bits INTEGER DEFAULT 0 NOT NULL,
505 img_media_type TEXT DEFAULT NULL,
506 img_major_mime TEXT DEFAULT 'unknown' NOT NULL,
507 img_minor_mime BLOB DEFAULT 'unknown' NOT NULL,
508 img_description_id BIGINT UNSIGNED NOT NULL,
509 img_actor BIGINT UNSIGNED NOT NULL,
510 img_timestamp BLOB NOT NULL,
511 img_sha1 BLOB DEFAULT '' NOT NULL,
512 PRIMARY KEY(img_name)
514 CREATE INDEX img_actor_timestamp ON /*_*/image (img_actor, img_timestamp);
515 CREATE INDEX img_size ON /*_*/image (img_size);
516 CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
517 CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
518 CREATE INDEX img_media_mime ON /*_*/image (
519 img_media_type, img_major_mime, img_minor_mime
521 CREATE TABLE /*_*/recentchanges (
522 rc_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
523 rc_timestamp BLOB NOT NULL, rc_actor BIGINT UNSIGNED NOT NULL,
524 rc_namespace INTEGER DEFAULT 0 NOT NULL,
525 rc_title BLOB DEFAULT '' NOT NULL, rc_comment_id BIGINT UNSIGNED NOT NULL,
526 rc_minor SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
527 rc_bot SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
528 rc_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
529 rc_cur_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
530 rc_this_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
531 rc_last_oldid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
532 rc_type SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
533 rc_source BLOB DEFAULT '' NOT NULL,
534 rc_patrolled SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
535 rc_ip BLOB DEFAULT '' NOT NULL, rc_old_len INTEGER DEFAULT NULL,
536 rc_new_len INTEGER DEFAULT NULL, rc_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
537 rc_logid INTEGER UNSIGNED DEFAULT 0 NOT NULL,
538 rc_log_type BLOB DEFAULT NULL, rc_log_action BLOB DEFAULT NULL,
539 rc_params BLOB DEFAULT NULL
541 CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
542 CREATE INDEX rc_namespace_title_timestamp ON /*_*/recentchanges (
543 rc_namespace, rc_title, rc_timestamp
545 CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
546 CREATE INDEX rc_new_name_timestamp ON /*_*/recentchanges (
547 rc_new, rc_namespace, rc_timestamp
549 CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
550 CREATE INDEX rc_ns_actor ON /*_*/recentchanges (rc_namespace, rc_actor);
551 CREATE INDEX rc_actor ON /*_*/recentchanges (rc_actor, rc_timestamp);
552 CREATE INDEX rc_name_type_patrolled_timestamp ON /*_*/recentchanges (
553 rc_namespace, rc_type, rc_patrolled,
556 CREATE INDEX rc_this_oldid ON /*_*/recentchanges (rc_this_oldid);
557 CREATE TABLE /*_*/archive (
558 ar_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
559 ar_namespace INTEGER DEFAULT 0 NOT NULL,
560 ar_title BLOB DEFAULT '' NOT NULL, ar_comment_id BIGINT UNSIGNED NOT NULL,
561 ar_actor BIGINT UNSIGNED NOT NULL,
562 ar_timestamp BLOB NOT NULL, ar_minor_edit SMALLINT DEFAULT 0 NOT NULL,
563 ar_rev_id INTEGER UNSIGNED NOT NULL,
564 ar_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
565 ar_len INTEGER UNSIGNED DEFAULT NULL,
566 ar_page_id INTEGER UNSIGNED DEFAULT NULL,
567 ar_parent_id INTEGER UNSIGNED DEFAULT NULL,
568 ar_sha1 BLOB DEFAULT '' NOT NULL
570 CREATE INDEX ar_name_title_timestamp ON /*_*/archive (
571 ar_namespace, ar_title, ar_timestamp
573 CREATE INDEX ar_actor_timestamp ON /*_*/archive (ar_actor, ar_timestamp);
574 CREATE UNIQUE INDEX ar_revid_uniq ON /*_*/archive (ar_rev_id);
575 CREATE TABLE /*_*/page (
576 page_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
577 page_namespace INTEGER NOT NULL, page_title BLOB NOT NULL,
578 page_is_redirect SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
579 page_is_new SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
580 page_random DOUBLE PRECISION NOT NULL,
581 page_touched BLOB NOT NULL, page_links_updated BLOB DEFAULT NULL,
582 page_latest INTEGER UNSIGNED NOT NULL,
583 page_len INTEGER UNSIGNED NOT NULL,
584 page_content_model BLOB DEFAULT NULL,
585 page_lang BLOB DEFAULT NULL
587 CREATE UNIQUE INDEX page_name_title ON /*_*/page (page_namespace, page_title);
588 CREATE INDEX page_random ON /*_*/page (page_random);
589 CREATE INDEX page_len ON /*_*/page (page_len);
590 CREATE INDEX page_redirect_namespace_len ON /*_*/page (
591 page_is_redirect, page_namespace,
594 CREATE TABLE /*_*/user (
595 user_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
596 user_name BLOB DEFAULT '' NOT NULL,
597 user_real_name BLOB DEFAULT '' NOT NULL,
598 user_password BLOB NOT NULL, user_newpassword BLOB NOT NULL,
599 user_newpass_time BLOB DEFAULT NULL,
600 user_email CLOB NOT NULL, user_touched BLOB NOT NULL,
601 user_token BLOB DEFAULT '' NOT NULL,
602 user_email_authenticated BLOB DEFAULT NULL,
603 user_email_token BLOB DEFAULT NULL,
604 user_email_token_expires BLOB DEFAULT NULL,
605 user_registration BLOB DEFAULT NULL,
606 user_editcount INTEGER UNSIGNED DEFAULT NULL,
607 user_password_expires BLOB DEFAULT NULL
609 CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
610 CREATE INDEX user_email_token ON /*_*/user (user_email_token);
611 CREATE INDEX user_email ON /*_*/user (user_email);
612 CREATE TABLE /*_*/user_autocreate_serial (
613 uas_shard INTEGER UNSIGNED NOT NULL,
614 uas_value INTEGER UNSIGNED NOT NULL,
615 PRIMARY KEY(uas_shard)
617 CREATE TABLE /*_*/revision (
618 rev_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
619 rev_page INTEGER UNSIGNED NOT NULL,
620 rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL,
621 rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL,
622 rev_timestamp BLOB NOT NULL, rev_minor_edit SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
623 rev_deleted SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
624 rev_len INTEGER UNSIGNED DEFAULT NULL,
625 rev_parent_id INTEGER UNSIGNED DEFAULT NULL,
626 rev_sha1 BLOB DEFAULT '' NOT NULL
628 CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
629 CREATE INDEX rev_page_timestamp ON /*_*/revision (rev_page, rev_timestamp);
630 CREATE INDEX rev_actor_timestamp ON /*_*/revision (rev_actor, rev_timestamp, rev_id);
631 CREATE INDEX rev_page_actor_timestamp ON /*_*/revision (
632 rev_page, rev_actor, rev_timestamp
634 CREATE TABLE /*_*/searchindex (
635 si_page INTEGER UNSIGNED NOT NULL,
636 si_title VARCHAR(255) DEFAULT '' NOT NULL,
637 si_text CLOB NOT NULL
639 CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page);
640 CREATE INDEX si_title ON /*_*/searchindex (si_title);
641 CREATE INDEX si_text ON /*_*/searchindex (si_text);
642 CREATE TABLE /*_*/linktarget (
643 lt_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
644 lt_namespace INTEGER NOT NULL, lt_title BLOB NOT NULL
646 CREATE UNIQUE INDEX lt_namespace_title ON /*_*/linktarget (lt_namespace, lt_title);