Denny Vrandečić proposed this database schema on the page.
-- Holds all the sites known to the wiki.
-- This includes their associated data and handling configuration.
-- In case a synchronization tool is used (ie Wikibase), the table
-- can be obtained from an external source, in which case
-- they should not be modified locally.
CREATE TABLE /*_*/site (
-- Numeric id of the site
site_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- Global identifier for the site, ie enwiktionary
site_global_key varchar(25) NOT NULL,
-- Type of the site, ie SITE_TYPE_MW
site_type int unsigned NOT NULL,
-- Group of the site, ie SITE_GROUP_WIKIPEDIA
site_group int unsigned NOT NULL,
-- Base URL of the site, ie http://en.wikipedia.org
site_url varchar(255) NOT NULL,
-- Path of pages relative to the base url, ie /wiki/$1
site_page_path varchar(255) NOT NULL,
-- Path of files relative to the base url, ie /w/
site_file_path varchar(255) NOT NULL,
-- Language code of the sites primary language.
-- We do not have real multilingual handling here by design,
-- as implementing it would require expensive changes in core
-- and would overcomplicate things. If you have a multilingual
-- site, for instance imdb, you can just create multiple rows
-- for it, ie imdben and imdbbe.
site_language varchar(10) NOT NULL,
-- Type dependent site data.
site_data blob NOT NULL
) /*$wgDBTableOptions*/;
-- Holds all the local site keys and data for the sites in site
CREATE TABLE /*_*/sitelocal (
-- local key
sitelocal_key VARCHAR(25) NOT NULL,
-- Key to site.site_id
site_id int unsigned NOT NULL,
-- If the site should be linkable inline as an "interwiki link" using
-- [[site_local_key:pageTitle]].
sitelocal_link_inline bool NOT NULL,
-- If equivalent pages of this site should be listed.
-- For example in the "language links" section.
sitelocal_link_navigation bool NOT NULL,
-- If site.tld/path/key:pageTitle should forward users to the page on
-- the actual site, where "key" is the local identifier.
sitelocal_forward bool NOT NULL,
-- Type dependent site config.
-- For instance if template transclusion should be allowed if it's a MediaWiki.
sitelocal_config blob NOT NULL
) /*$wgDBTableOptions*/;
Mapping of use cases to schema
- (1) GlobalIDs:
site.site_global_key
- (2) Multiple IDs: there can be several
sitelocal_key
for a singlesite_id
- (3) Types and Typed data:
site_type
andsite_data
, for local differences alsositelocal_config
- (4) Languages:
site_language
- (5) Arbitrary language links:
sitelocal_link_inline
,sitelocal_link_navigation
- (6) Groups:
site_group
- (7) Custom URLs:
site_url
,site_page_path
,site_file_path
, as well as further data insite_data
andsitelocal_config
- (8) Unprefixed sites: no entry in
sitelocal
for asite_id
means an unprefixed site, basically - (9) Synchronization: the split between
site
andsitelocal
splits the global and local data - (10) Site title: not present now. Is there consensus for this?
- (11) iw_api: covered by
site_url
andsite_file_path
(orsite_data
) - (12) iw_wikiid: covered either by
site_global_key
orsite_data
- (13) iw_local:
sitelocal_forward
- (14) iw_trans:
sitelocal_config
orsite_data
- (15) UI: not covered by schema