WMF DBAs have been doing a massive effort to convert UNIQUE KEYS into PRIMARY KEY. Having a PK is essential to do maintenance, specially on large tasks. By not having a PK it is impossible to add it in a safe way if not done directly on the master. Having a PK means that we can easily change the PK into another one if needed in the future. The ones we chose might not be the best ones, but will allow us to get them changed. Bug: T172514 Change-Id: Id635297838938c7c5dfe65d45285a4d16d65152d
25 lines
No EOL
918 B
SQL
25 lines
No EOL
918 B
SQL
CREATE TABLE /*_*/imagelinks_tmp (
|
|
-- Key to page_id of the page containing the image / media link.
|
|
il_from int unsigned NOT NULL default 0,
|
|
-- Namespace for this page
|
|
il_from_namespace int NOT NULL default 0,
|
|
|
|
-- Filename of target image.
|
|
-- This is also the page_title of the file's description page;
|
|
-- all such pages are in namespace 6 (NS_FILE).
|
|
il_to varchar(255) binary NOT NULL default '',
|
|
PRIMARY KEY (il_from,il_to)
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
INSERT INTO /*_*/imagelinks_tmp
|
|
SELECT * FROM /*_*/imagelinks;
|
|
|
|
DROP TABLE /*_*/imagelinks;
|
|
|
|
ALTER TABLE /*_*/imagelinks_tmp RENAME TO /*_*/imagelinks;
|
|
|
|
-- Reverse index, for Special:Whatlinkshere and file description page local usage
|
|
CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
|
|
|
|
-- Index for Special:Whatlinkshere with namespace filter
|
|
CREATE INDEX /*i*/il_backlinks_namespace ON /*_*/imagelinks (il_from_namespace,il_to,il_from); |