1 -- Patch to add the sites and site_identifiers tables.
2 -- Licence: GNU GPL v2+
3 -- Author: Jeroen De Dauw < jeroendedauw@gmail.com >
6 -- Holds all the sites known to the wiki.
7 CREATE TABLE IF NOT EXISTS /*_*/sites (
8 -- Numeric id of the site
9 site_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
11 -- Global identifier for the site, ie 'enwiktionary'
12 site_global_key varbinary(32) NOT NULL,
14 -- Type of the site, ie 'mediawiki'
15 site_type varbinary(32) NOT NULL,
17 -- Group of the site, ie 'wikipedia'
18 site_group varbinary(32) NOT NULL,
20 -- Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'
21 site_source varbinary(32) NOT NULL,
23 -- Language code of the sites primary language.
24 site_language varbinary(32) NOT NULL,
26 -- Protocol of the site, ie 'http://', 'irc://', '//'
27 -- This field is an index for lookups and is build from type specific data in site_data.
28 site_protocol varbinary(32) NOT NULL,
30 -- Domain of the site in reverse order, ie 'org.mediawiki.www.'
31 -- This field is an index for lookups and is build from type specific data in site_data.
32 site_domain VARCHAR(255) NOT NULL,
34 -- Type dependent site data.
35 site_data BLOB NOT NULL,
37 -- If site.tld/path/key:pageTitle should forward users to the page on
38 -- the actual site, where "key" is the local identifier.
39 site_forward bool NOT NULL,
41 -- Type dependent site config.
42 -- For instance if template transclusion should be allowed if it's a MediaWiki.
43 site_config BLOB NOT NULL
44 ) /*$wgDBTableOptions*/;
46 CREATE UNIQUE INDEX /*i*/sites_global_key ON /*_*/sites (site_global_key);
47 CREATE INDEX /*i*/sites_type ON /*_*/sites (site_type);
48 CREATE INDEX /*i*/sites_group ON /*_*/sites (site_group);
49 CREATE INDEX /*i*/sites_source ON /*_*/sites (site_source);
50 CREATE INDEX /*i*/sites_language ON /*_*/sites (site_language);
51 CREATE INDEX /*i*/sites_protocol ON /*_*/sites (site_protocol);
52 CREATE INDEX /*i*/sites_domain ON /*_*/sites (site_domain);
53 CREATE INDEX /*i*/sites_forward ON /*_*/sites (site_forward);
57 -- Links local site identifiers to their corresponding site.
58 CREATE TABLE IF NOT EXISTS /*_*/site_identifiers (
59 -- Key on site.site_id
60 si_site INT UNSIGNED NOT NULL,
62 -- local key type, ie 'interwiki' or 'langlink'
63 si_type varbinary(32) NOT NULL,
65 -- local key value, ie 'en' or 'wiktionary'
66 si_key varbinary(32) NOT NULL
67 ) /*$wgDBTableOptions*/;
69 CREATE UNIQUE INDEX /*i*/site_ids_type ON /*_*/site_identifiers (si_type, si_key);
70 CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
71 CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);