Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / maintenance / archives / patch-linktables.sql
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',
9
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',
15
16 UNIQUE KEY l_from(l_from,l_to),
17 KEY (l_to)
18
19 ) /*$wgDBTableOptions*/;
20
21 --
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)
25 --
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',
30
31 -- Text of the target page title ("namespace: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)
37
38 ) /*$wgDBTableOptions*/;
39
40 --
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.
44 --
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',
49
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 '',
54
55 UNIQUE KEY il_from(il_from,il_to),
56 KEY (il_to)
57
58 ) /*$wgDBTableOptions*/;
59
60 --
61 -- Stores (possibly gzipped) serialized objects with
62 -- cache arrays to reduce database load slurping up
63 -- from links and brokenlinks.
64 --
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
69
70 ) /*$wgDBTableOptions*/;