wiki.techinc.nl/maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql
Reedy 0f13fff160 Convert UNIQUE keys into PRIMARY KEY
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
2017-08-29 18:25:37 +01:00

15 lines
No EOL
452 B
SQL

CREATE TABLE /*_*/querycache_info_tmp (
-- Special page name
-- Corresponds to a qc_type value
qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
-- Timestamp of last update
qci_timestamp binary(14) NOT NULL default '19700101000000'
) /*$wgDBTableOptions*/;
INSERT INTO /*_*/querycache_info_tmp
SELECT * FROM /*_*/querycache_info;
DROP TABLE /*_*/querycache_info;
ALTER TABLE /*_*/querycache_info_tmp RENAME TO /*_*/querycache_info;