Manual:Database layout/diagram/1.41.0

From mediawiki.org

Full screen

Database schema of MediaWiki 1.41 (November 2023).
Refer to https://www.mediawiki.org/wiki/DB for more details.

User

actor

  • actor_id BIGINT
  • actor_user INT
  • actor_name BINARY(255)

user

  • user_id INT
  • user_name BINARY(255)
  • user_real_name BINARY(255)
  • user_password BLOB(255)
  • user_newpassword BLOB(255)
  • user_newpass_time MWTIMESTAMP
  • user_email TEXT(255)
  • user_touched MWTIMESTAMP
  • user_token BINARY(32)
  • user_email_authenticated MWTIMESTAMP
  • user_email_token BINARY(32)
  • user_email_token_expires MWTIMESTAMP
  • user_registration MWTIMESTAMP
  • user_editcount INT
  • user_password_expires MWTIMESTAMP
  • user_is_temp TINYINT(1)

user_autocreate_serial

  • uas_shard INT
  • uas_value INT

user_properties

  • up_user INT
  • up_property BINARY(255)
  • up_value BLOB

user_newtalk

  • user_id INT
  • user_ip BINARY(40)
  • user_last_timestamp MWTIMESTAMP

bot_passwords

  • bp_user INT
  • bp_app_id BINARY(32)
  • bp_password BLOB(255)
  • bp_token BINARY(32)
  • bp_restrictions BLOB
  • bp_grants BLOB

Permissions

user_groups

  • ug_user INT
  • ug_group BINARY(255)
  • ug_expiry MWTIMESTAMP

user_former_groups

  • ufg_user INT
  • ufg_group BINARY(255)

page_restrictions

  • pr_id INT
  • pr_page INT
  • pr_type BINARY(60)
  • pr_level BINARY(60)
  • pr_cascade TINYINT
  • pr_expiry MWTIMESTAMP

protected_titles

  • pt_namespace INT
  • pt_title BINARY(255)
  • pt_user INT
  • pt_reason_id BIGINT
  • pt_timestamp MWTIMESTAMP
  • pt_expiry MWTIMESTAMP
  • pt_create_perm BINARY(60)

ipblocks

  • ipb_id INT
  • ipb_address BLOB(255)
  • ipb_user INT
  • ipb_by_actor BIGINT
  • ipb_reason_id BIGINT
  • ipb_timestamp MWTIMESTAMP
  • ipb_auto TINYINT(1)
  • ipb_anon_only TINYINT(1)
  • ipb_create_account TINYINT(1)
  • ipb_enable_autoblock TINYINT(1)
  • ipb_expiry MWTIMESTAMP
  • ipb_range_start BLOB(255)
  • ipb_range_end BLOB(255)
  • ipb_deleted TINYINT(1)
  • ipb_block_email TINYINT(1)
  • ipb_allow_usertalk TINYINT(1)
  • ipb_parent_block_id INT
  • ipb_sitewide TINYINT(1)

ipblocks_restrictions

  • ir_ipb_id INT
  • ir_type TINYINT(4)
  • ir_value INT

Logging

logging

  • log_id INT
  • log_type BINARY(32)
  • log_action BINARY(32)
  • log_timestamp MWTIMESTAMP
  • log_actor BIGINT
  • log_namespace INT
  • log_title BINARY(255)
  • log_page INT
  • log_comment_id BIGINT
  • log_params BLOB
  • log_deleted TINYINT

log_search

  • ls_field BINARY(32)
  • ls_value STRING(255)
  • ls_log_id INT

comment

  • comment_id BIGINT
  • comment_hash INT
  • comment_text BLOB
  • comment_data BLOB

Tags

change_tag

  • ct_id INT
  • ct_rc_id INT
  • ct_log_id INT
  • ct_rev_id INT
  • ct_params BLOB
  • ct_tag_id INT

change_tag_def

  • ctd_id INT
  • ctd_name BINARY(255)
  • ctd_user_defined TINYINT(1)
  • ctd_count BIGINT

Recent changes

recentchanges

  • rc_id INT
  • rc_timestamp MWTIMESTAMP
  • rc_actor BIGINT
  • rc_namespace INT
  • rc_title BINARY(255)
  • rc_comment_id BIGINT
  • rc_minor TINYINT
  • rc_bot TINYINT
  • rc_new TINYINT
  • rc_cur_id INT
  • rc_this_oldid INT
  • rc_last_oldid INT
  • rc_type TINYINT
  • rc_source BINARY(16)
  • rc_patrolled TINYINT
  • rc_ip BINARY(40)
  • rc_old_len INT
  • rc_new_len INT
  • rc_deleted TINYINT
  • rc_logid INT
  • rc_log_type BINARY(255)
  • rc_log_action BINARY(255)
  • rc_params BLOB

watchlist

  • wl_id INT
  • wl_user INT
  • wl_namespace INT
  • wl_title BINARY(255)
  • wl_notificationtimestamp MWTIMESTAMP

watchlist_expiry

  • we_item INT
  • we_expiry MWTIMESTAMP

Pages

page

  • page_id INT
  • page_namespace INT
  • page_title BINARY(255)
  • page_is_redirect TINYINT
  • page_is_new TINYINT
  • page_random FLOAT
  • page_touched MWTIMESTAMP
  • page_links_updated MWTIMESTAMP
  • page_latest INT
  • page_len INT
  • page_content_model BINARY(32)
  • page_lang BINARY(35)

archive

  • ar_id INT
  • ar_namespace INT
  • ar_title BINARY(255)
  • ar_comment_id BIGINT
  • ar_actor BIGINT
  • ar_timestamp MWTIMESTAMP
  • ar_minor_edit TINYINT
  • ar_rev_id INT
  • ar_deleted TINYINT
  • ar_len INT
  • ar_page_id INT
  • ar_parent_id INT
  • ar_sha1 BINARY(32)

redirect

  • rd_from INT
  • rd_namespace INT
  • rd_title BINARY(255)
  • rd_interwiki STRING(32)
  • rd_fragment BINARY(255)

category

  • cat_id INT
  • cat_title BINARY(255)
  • cat_pages INT
  • cat_subcats INT
  • cat_files INT

Revisions

revision

  • rev_id INT
  • rev_page INT
  • rev_comment_id BIGINT
  • rev_actor BIGINT
  • rev_timestamp MWTIMESTAMP
  • rev_minor_edit TINYINT
  • rev_deleted TINYINT
  • rev_len INT
  • rev_parent_id INT
  • rev_sha1 BINARY(32)

slots

  • slot_revision_id BIGINT
  • slot_role_id SMALLINT
  • slot_content_id BIGINT
  • slot_origin BIGINT

slot_roles

  • role_id INT
  • role_name BINARY(64)

ip_changes

  • ipc_rev_id INT
  • ipc_rev_timestamp MWTIMESTAMP
  • ipc_hex BINARY(35)

content

  • content_id BIGINT
  • content_size INT
  • content_sha1 BINARY(32)
  • content_model SMALLINT
  • content_address BINARY(255)

content_models

  • model_id INT
  • model_name BINARY(64)

text

  • old_id INT
  • old_text BLOB
  • old_flags BLOB(255)

Link tables

pagelinks

  • pl_from INT
  • pl_namespace INT
  • pl_title BINARY(255)
  • pl_from_namespace INT
  • pl_target_id BIGINT

imagelinks

  • il_from INT
  • il_from_namespace INT
  • il_to BINARY(255)

templatelinks

  • tl_from INT
  • tl_from_namespace INT
  • tl_target_id BIGINT

iwlinks

  • iwl_from INT
  • iwl_prefix BINARY(32)
  • iwl_title BINARY(255)

externallinks

  • el_id INT
  • el_from INT
  • el_to_domain_index BINARY(255)
  • el_to_path BLOB

langlinks

  • ll_from INT
  • ll_lang BINARY(35)
  • ll_title BINARY(255)

categorylinks

  • cl_from INT
  • cl_to BINARY(255)
  • cl_sortkey BINARY(230)
  • cl_sortkey_prefix BINARY(255)
  • cl_timestamp DATETIMETZ
  • cl_collation BINARY(32)
  • cl_type ENUM(…)

linktarget

  • lt_id BIGINT
  • lt_namespace INT
  • lt_title BINARY(255)

page_props

  • pp_page INT
  • pp_propname BINARY(60)
  • pp_value BLOB
  • pp_sortkey FLOAT

Statistics

site_stats

  • ss_row_id INT
  • ss_total_edits BIGINT
  • ss_good_articles BIGINT
  • ss_total_pages BIGINT
  • ss_users BIGINT
  • ss_active_users BIGINT
  • ss_images BIGINT

Search

searchindex

  • si_page INT
  • si_title STRING(255)
  • si_text TEXT

Maintenance

job

  • job_id INT
  • job_cmd BINARY(60)
  • job_namespace INT
  • job_title BINARY(255)
  • job_timestamp MWTIMESTAMP
  • job_params BLOB
  • job_random INT
  • job_attempts INT
  • job_token BINARY(32)
  • job_token_timestamp MWTIMESTAMP
  • job_sha1 BINARY(32)

updatelog

  • ul_key STRING(255)
  • ul_value BLOB

Multimedia

image

  • img_name BINARY(255)
  • img_size BIGINT
  • img_width INT
  • img_height INT
  • img_metadata BLOB
  • img_bits INT
  • img_media_type ENUM(…)
  • img_major_mime ENUM(…)
  • img_minor_mime BINARY(100)
  • img_description_id BIGINT
  • img_actor BIGINT
  • img_timestamp MWTIMESTAMP
  • img_sha1 BINARY(32)

oldimage

  • oi_name BINARY(255)
  • oi_archive_name BINARY(255)
  • oi_size BIGINT
  • oi_width INT
  • oi_height INT
  • oi_bits INT
  • oi_description_id BIGINT
  • oi_actor BIGINT
  • oi_timestamp MWTIMESTAMP
  • oi_metadata BLOB
  • oi_media_type ENUM(…)
  • oi_major_mime ENUM(…)
  • oi_minor_mime BINARY(100)
  • oi_deleted TINYINT
  • oi_sha1 BINARY(32)

filearchive

  • fa_id INT
  • fa_name BINARY(255)
  • fa_archive_name BINARY(255)
  • fa_storage_group BINARY(16)
  • fa_storage_key BINARY(64)
  • fa_deleted_user INT
  • fa_deleted_timestamp MWTIMESTAMP
  • fa_deleted_reason_id BIGINT
  • fa_size BIGINT
  • fa_width INT
  • fa_height INT
  • fa_metadata BLOB
  • fa_bits INT
  • fa_media_type ENUM(…)
  • fa_major_mime ENUM(…)
  • fa_minor_mime BINARY(100)
  • fa_description_id BIGINT
  • fa_actor BIGINT
  • fa_timestamp MWTIMESTAMP
  • fa_deleted TINYINT
  • fa_sha1 BINARY(32)

uploadstash

  • us_id INT
  • us_user INT
  • us_key STRING(255)
  • us_orig_path STRING(255)
  • us_path STRING(255)
  • us_source_type STRING(50)
  • us_timestamp MWTIMESTAMP
  • us_status STRING(50)
  • us_chunk_inx INT
  • us_props BLOB
  • us_size BIGINT
  • us_sha1 STRING(31)
  • us_mime STRING(255)
  • us_media_type ENUM(…)
  • us_image_width INT
  • us_image_height INT
  • us_image_bits SMALLINT

Sites

sites

  • site_id INT
  • site_global_key BINARY(64)
  • site_type BINARY(32)
  • site_group BINARY(32)
  • site_source BINARY(32)
  • site_language BINARY(35)
  • site_protocol BINARY(32)
  • site_domain STRING(255)
  • site_data BLOB
  • site_forward TINYINT(1)
  • site_config BLOB

site_identifiers

  • si_type BINARY(32)
  • si_key BINARY(32)
  • si_site INT

interwiki

  • iw_prefix STRING(32)
  • iw_url BLOB
  • iw_api BLOB
  • iw_wikiid STRING(64)
  • iw_local TINYINT(1)
  • iw_trans TINYINT

Caching tables

querycache

  • qc_type BINARY(32)
  • qc_value INT
  • qc_namespace INT
  • qc_title BINARY(255)

objectcache

  • keyname BINARY(255)
  • value BLOB
  • exptime MWTIMESTAMP
  • modtoken STRING(17)
  • flags INT

querycachetwo

  • qcc_type BINARY(32)
  • qcc_value INT
  • qcc_namespace INT
  • qcc_title BINARY(255)
  • qcc_namespacetwo INT
  • qcc_titletwo BINARY(255)

querycache_info

  • qci_type BINARY(32)
  • qci_timestamp MWTIMESTAMP

l10n_cache

  • lc_lang BINARY(35)
  • lc_key STRING(255)
  • lc_value BLOB

ResourceLoader

module_deps

  • md_module BINARY(255)
  • md_skin BINARY(32)
  • md_deps BLOB

Credit: Nick Jenkins, Timo Tijhof / CC BY-SA 4.0

From https://www.mediawiki.org/wiki/Manual:Database_layout/diagram/1.41.0