wiki.techinc.nl/maintenance/sqlite/archives/patch-interwiki-fix-pk.sql
Reedy 267d99fa85 Convert numerous UNIQUE INDEX to PRIMARY KEY
MySQL, SQLite, PostgreSQL and MSSQL done with transitional patches.

One additional duplicate index removed from PostgreSQL schema.

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: T198811
Change-Id: I6b96a427687085c6c24bcd759c9739f81288b919
2018-07-11 20:36:33 +01:00

29 lines
971 B
SQL

CREATE TABLE /*_*/interwiki_tmp (
-- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
iw_prefix varchar(32) NOT NULL PRIMARY KEY,
-- The URL of the wiki, with "$1" as a placeholder for an article name.
-- Any spaces in the name will be transformed to underscores before
-- insertion.
iw_url blob NOT NULL,
-- The URL of the file api.php
iw_api blob NOT NULL,
-- The name of the database (for a connection to be established with LBFactory::getMainLB( 'wikiid' ))
iw_wikiid varchar(64) NOT NULL,
-- A boolean value indicating whether the wiki is in this project
-- (used, for example, to detect redirect loops)
iw_local bool NOT NULL,
-- Boolean value indicating whether interwiki transclusions are allowed.
iw_trans tinyint NOT NULL default 0
) /*$wgDBTableOptions*/;
INSERT INTO /*_*/interwiki_tmp
SELECT * FROM /*_*/interwiki;
DROP TABLE /*_*/interwiki;
ALTER TABLE /*_*/interwiki_tmp RENAME TO /*_*/interwiki;