]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - maintenance/archives/patch-redirect.sql
MediaWiki 1.11.0
[autoinstalls/mediawiki.git] / maintenance / archives / patch-redirect.sql
1 --
2 -- Create the new redirect table.
3 -- For each redirect, this table contains exactly one row defining its target
4 -- 
5 CREATE TABLE /*$wgDBprefix*/redirect (
6   -- Key to the page_id of the redirect page
7   rd_from int unsigned NOT NULL default '0',
8
9   -- Key to page_namespace/page_title of the target page.
10   -- The target page may or may not exist, and due to renames
11   -- and deletions may refer to different page records as time
12   -- goes by.
13   rd_namespace int NOT NULL default '0',
14   rd_title varchar(255) binary NOT NULL default '',
15
16   PRIMARY KEY rd_from (rd_from),
17   KEY rd_ns_title (rd_namespace,rd_title,rd_from)
18 ) /*$wgDBTableOptions*/;
19
20 -- Import existing redirects
21 -- Using ignore because some of the redirect pages contain more than one link
22 INSERT IGNORE
23   INTO /*$wgDBprefix*/redirect (rd_from,rd_namespace,rd_title)
24   SELECT pl_from,pl_namespace,pl_title
25     FROM /*$wgDBprefix*/pagelinks, /*$wgDBprefix*/page
26     WHERE pl_from=page_id AND page_is_redirect=1;
27
28