Merge "Hooks: Introduce Hooks::runWithoutAbort() alongside Hooks::run()"
[lhc/web/wiklou.git] / maintenance / sqlite / archives / patch-pagelinks-fix-pk.sql
1 CREATE TABLE /*_*/pagelinks_tmp (
2 -- Key to the page_id of the page containing the link.
3 pl_from int unsigned NOT NULL default 0,
4 -- Namespace for this page
5 pl_from_namespace int NOT NULL default 0,
6
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
10 -- goes by.
11 pl_namespace int NOT NULL default 0,
12 pl_title varchar(255) binary NOT NULL default '',
13 PRIMARY KEY (pl_from,pl_namespace,pl_title)
14 ) /*$wgDBTableOptions*/;
15
16 INSERT INTO /*_*/pagelinks_tmp
17 SELECT * FROM /*_*/pagelinks;
18
19 DROP TABLE /*_*/pagelinks;
20
21 ALTER TABLE /*_*/pagelinks_tmp RENAME TO /*_*/pagelinks;
22
23 -- Reverse index, for Special:Whatlinkshere
24 CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
25
26 -- Index for Special:Whatlinkshere with namespace filter
27 CREATE INDEX /*i*/pl_backlinks_namespace ON /*_*/pagelinks (pl_from_namespace,pl_namespace,pl_title,pl_from);