Fixes and improvements to interwiki transclusion:
[lhc/web/wiklou.git] / maintenance / mysql5 / tables.sql
index 025514b..1186250 100644 (file)
@@ -384,6 +384,26 @@ CREATE TABLE /*$wgDBprefix*/pagelinks (
 ) TYPE=InnoDB, DEFAULT CHARSET=utf8;
 
 
+--
+-- Track template inclusions.
+--
+CREATE TABLE /*$wgDBprefix*/templatelinks (
+  -- Key to the page_id of the page containing the link.
+  tl_from int(8) unsigned NOT NULL default '0',
+  
+  -- Key to page_namespace/page_title of the target page.
+  -- The target page may or may not exist, and due to renames
+  -- and deletions may refer to different page records as time
+  -- goes by.
+  tl_namespace int NOT NULL default '0',
+  tl_title varchar(255) binary NOT NULL default '',
+  
+  UNIQUE KEY tl_from(tl_from,tl_namespace,tl_title),
+  KEY (tl_namespace,tl_title)
+
+) TYPE=InnoDB, DEFAULT CHARSET=utf8;
+
+
 --
 -- Track links to images *used inline*
 -- We don't distinguish live from broken links here, so
@@ -442,6 +462,34 @@ CREATE TABLE /*$wgDBprefix*/categorylinks (
 
 ) TYPE=InnoDB, DEFAULT CHARSET=utf8;
 
+--
+-- Track links to external URLs
+--
+CREATE TABLE /*$wgDBprefix*/externallinks (
+  -- page_id of the referring page
+  el_from int(8) unsigned NOT NULL default '0',
+
+  -- The URL
+  el_to blob NOT NULL default '',
+
+  -- In the case of HTTP URLs, this is the URL with any username or password
+  -- removed, and with the labels in the hostname reversed and converted to 
+  -- lower case. An extra dot is added to allow for matching of either
+  -- example.com or *.example.com in a single scan.
+  -- Example: 
+  --      http://user:password@sub.example.com/page.html
+  --   becomes
+  --      http://com.example.sub./page.html
+  -- which allows for fast searching for all pages under example.com with the
+  -- clause: 
+  --      WHERE el_index LIKE 'http://com.example.%'
+  el_index blob NOT NULL default '',
+  
+  KEY (el_from, el_to(40)),
+  KEY (el_to(60), el_from),
+  KEY (el_index(60))
+) TYPE=InnoDB, DEFAULT CHARSET=utf8;
+
 --
 -- Contains a single row with some aggregate info
 -- on the state of the site.
@@ -803,6 +851,16 @@ CREATE TABLE /*$wgDBprefix*/objectcache (
 
 ) TYPE=InnoDB, DEFAULT CHARSET=utf8;
 
+--
+-- Cache of interwiki transclusion
+--
+CREATE TABLE /*$wgDBprefix*/transcache (
+       tc_url          VARCHAR(255) NOT NULL,
+       tc_contents     TEXT,
+       tc_time         INT NOT NULL,
+       UNIQUE INDEX tc_url_idx(tc_url)
+) TYPE=InnoDB, DEFAULT CHARSET=utf8;
+
 -- For article validation
 CREATE TABLE /*$wgDBprefix*/validate (
   val_user int(11) NOT NULL default '0',