1 CREATE TABLE /*_*/templatelinks_tmp (
2 -- Key to the page_id of the page containing the link.
3 tl_from
int unsigned
NOT NULL default 0,
4 -- Namespace for this page
5 tl_from_namespace
int NOT NULL default 0,
7 -- Key to page_namespace/page_title of the target page.
8 -- The target page may or may not exist, and due to renames
9 -- and deletions may refer to different page records as time
11 tl_namespace
int NOT NULL default 0,
12 tl_title
varchar(255) binary NOT NULL default '',
13 PRIMARY KEY (tl_from
,tl_namespace
,tl_title
)
14 ) /*$wgDBTableOptions*/;
16 INSERT INTO /*_*/templatelinks_tmp
17 SELECT * FROM /*_*/templatelinks
;
19 DROP TABLE /*_*/templatelinks
;
21 ALTER TABLE /*_*/templatelinks_tmp
RENAME TO /*_*/templatelinks
;
23 -- Reverse index, for Special:Whatlinkshere
24 CREATE INDEX /*i*/tl_namespace
ON /*_*/templatelinks (tl_namespace
,tl_title
,tl_from
);
26 -- Index for Special:Whatlinkshere with namespace filter
27 CREATE INDEX /*i*/tl_backlinks_namespace
ON /*_*/templatelinks (tl_from_namespace
,tl_namespace
,tl_title
,tl_from
);