Merge "Fix usage of $wgDebugDumpSql"
[mediawiki.git] / maintenance / archives / patch-linktables.sql
blobd53d2ea3ad5e8d025da7fc298932e605e1fea556
1 --
2 -- Track links that do exist
3 -- l_from and l_to key to cur_id
4 --
5 DROP TABLE IF EXISTS /*$wgDBprefix*/links;
6 CREATE TABLE /*$wgDBprefix*/links (
7   -- Key to the page_id of the page containing the link.
8   l_from int unsigned NOT NULL default '0',
10   -- Key to the page_id of the link target.
11   -- An unfortunate consequence of this is that rename
12   -- operations require changing the links entries for
13   -- all links to the moved page.
14   l_to int unsigned NOT NULL default '0',
16   UNIQUE KEY l_from(l_from,l_to),
17   KEY (l_to)
19 ) /*$wgDBTableOptions*/;
22 -- Track links to pages that don't yet exist.
23 -- bl_from keys to cur_id
24 -- bl_to is a text link (namespace:title)
26 DROP TABLE IF EXISTS /*$wgDBprefix*/brokenlinks;
27 CREATE TABLE /*$wgDBprefix*/brokenlinks (
28   -- Key to the page_id of the page containing the link.
29   bl_from int unsigned NOT NULL default '0',
31   -- Text of the target page title ("namesapce:title").
32   -- Unfortunately this doesn't split the namespace index
33   -- key and therefore can't easily be joined to anything.
34   bl_to varchar(255) binary NOT NULL default '',
35   UNIQUE KEY bl_from(bl_from,bl_to),
36   KEY (bl_to)
38 ) /*$wgDBTableOptions*/;
41 -- Track links to images *used inline*
42 -- il_from keys to cur_id, il_to keys to image_name.
43 -- We don't distinguish live from broken links.
45 DROP TABLE IF EXISTS /*$wgDBprefix*/imagelinks;
46 CREATE TABLE /*$wgDBprefix*/imagelinks (
47   -- Key to page_id of the page containing the image / media link.
48   il_from int unsigned NOT NULL default '0',
50   -- Filename of target image.
51   -- This is also the page_title of the file's description page;
52   -- all such pages are in namespace 6 (NS_FILE).
53   il_to varchar(255) binary NOT NULL default '',
55   UNIQUE KEY il_from(il_from,il_to),
56   KEY (il_to)
58 ) /*$wgDBTableOptions*/;
61 -- Stores (possibly gzipped) serialized objects with
62 -- cache arrays to reduce database load slurping up
63 -- from links and brokenlinks.
65 DROP TABLE IF EXISTS /*$wgDBprefix*/linkscc;
66 CREATE TABLE /*$wgDBprefix*/linkscc (
67   lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
68   lcc_cacheobj MEDIUMBLOB NOT NULL
70 ) /*$wgDBTableOptions*/;