* String type for $lang of DifferenceEngine::setTextLanguage is deprecated.
=== Other changes in 1.32 ===
+* (T198811) The following tables have had their UNIQUE indexes turned into proper
+ PRIMARY KEYs for increased maintainability: interwiki, page_props,
+ protected_titles and site_identifiers.
* …
== Compatibility ==
[ 'populateContentTables' ],
[ 'addIndex', 'logging', 'log_type_action', 'patch-logging-log-type-action-index.sql' ],
[ 'dropIndex', 'logging', 'type_action', 'patch-logging-drop-type-action-index.sql' ],
+ [ 'addIndex', 'interwiki', 'PRIMARY', 'patch-interwiki-pk.sql' ],
+ [ 'addIndex', 'protected_titles', 'PRIMARY', 'patch-protected_titles-pk.sql' ],
+ [ 'addIndex', 'page_props', 'PRIMARY', 'patch-page_props-pk.sql' ],
+ [ 'addIndex', 'site_identifiers', 'PRIMARY', 'patch-site_identifiers-pk.sql' ],
];
}
[ 'populateContentTables' ],
[ 'addIndex', 'logging', 'log_type_action', 'patch-logging-log-type-action-index.sql' ],
[ 'dropIndex', 'logging', 'type_action', 'patch-logging-drop-type-action-index.sql' ],
+ [ 'renameIndex', 'interwiki', 'iw_prefix', 'PRIMARY', false, 'patch-interwiki-fix-pk.sql' ],
+ [ 'renameIndex', 'page_props', 'pp_page_propname', 'PRIMARY', false,
+ 'patch-page_props-fix-pk.sql' ],
+ [ 'renameIndex', 'protected_titles', 'pt_namespace_title', 'PRIMARY', false,
+ 'patch-protected_titles-fix-pk.sql' ],
+ [ 'renameIndex', 'site_identifiers', 'site_ids_type', 'PRIMARY', false,
+ 'patch-site_identifiers-fix-pk.sql' ],
];
}
[ 'dropPgIndex', 'archive', 'ar_revid' ], // Probably doesn't exist, but do it anyway.
[ 'populateContentTables' ],
[ 'addPgIndex', 'logging', 'log_type_action', '( log_type, log_action, log_timestamp )' ],
+ [ 'dropPgIndex', 'page_props', 'page_props_propname' ],
+ [ 'addIndex', 'interwiki', 'interwiki_pkey', 'patch-interwiki-pk.sql' ],
+ [ 'addIndex', 'protected_titles', 'protected_titles_pkey', 'patch-protected_titles-pk.sql' ],
+ [ 'addIndex', 'site_identifiers', 'site_identifiers_pkey', 'patch-site_identifiers-pk.sql' ],
];
}
[ 'populateContentTables' ],
[ 'addIndex', 'logging', 'log_type_action', 'patch-logging-log-type-action-index.sql' ],
[ 'dropIndex', 'logging', 'type_action', 'patch-logging-drop-type-action-index.sql' ],
+ [ 'renameIndex', 'interwiki', 'iw_prefix', 'PRIMARY', false, 'patch-interwiki-fix-pk.sql' ],
+ [ 'renameIndex', 'page_props', 'pp_page_propname', 'PRIMARY', false,
+ 'patch-page_props-fix-pk.sql' ],
+ [ 'renameIndex', 'protected_titles', 'pt_namespace_title', 'PRIMARY', false,
+ 'patch-protected_titles-fix-pk.sql' ],
+ [ 'renameIndex', 'site_identifiers', 'site_ids_type', 'PRIMARY', false,
+ 'patch-site_identifiers-fix-pk.sql' ],
];
}
--- /dev/null
+ALTER TABLE /*_*/interwiki DROP KEY /*i*/iw_prefix, ADD PRIMARY KEY (iw_prefix);
--- /dev/null
+ALTER TABLE /*_*/page_props DROP KEY /*i*/pp_page_propname, ADD PRIMARY KEY (pp_page,pp_propname);
--- /dev/null
+ALTER TABLE /*_*/protected_titles DROP KEY /*i*/pt_namespace_title, ADD PRIMARY KEY (pt_namespace,pt_title);
--- /dev/null
+ALTER TABLE /*_*/site_identifiers DROP KEY /*i*/site_ids_type, ADD PRIMARY KEY (si_type,si_key);
--- /dev/null
+DROP INDEX IF EXISTS /*i*/iw_prefix ON /*_*/interwiki;
+ALTER TABLE /*_*/interwiki ADD CONSTRAINT PK_interwiki PRIMARY KEY(iw_prefix);
\ No newline at end of file
--- /dev/null
+DROP INDEX IF EXISTS /*i*/pp_page_propname ON /*_*/page_props;
+ALTER TABLE /*_*/page_props ADD CONSTRAINT PK_page_props PRIMARY KEY(pp_page,pp_propname);
\ No newline at end of file
--- /dev/null
+DROP INDEX IF EXISTS /*i*/pt_namespace_title ON /*_*/protected_titles;
+ALTER TABLE /*_*/protected_titles ADD CONSTRAINT PK_protected_titles PRIMARY KEY(pt_namespace,pt_title);
\ No newline at end of file
--- /dev/null
+DROP INDEX IF EXISTS /*i*/site_ids_type ON /*_*/site_identifiers;
+ALTER TABLE /*_*/site_identifiers ADD CONSTRAINT PK_site_identifiers PRIMARY KEY(si_type, si_key);
\ No newline at end of file
--
CREATE TABLE /*_*/interwiki (
-- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
- iw_prefix nvarchar(32) NOT NULL,
+ iw_prefix nvarchar(32) NOT NULL CONSTRAINT PK_interwiki 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
iw_trans bit NOT NULL default 0
);
-CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix);
-
-
--
-- Used for caching expensive grouped queries
--
pt_reason_id bigint unsigned NOT NULL CONSTRAINT DF_pt_reason_id DEFAULT 0 CONSTRAINT FK_pt_reason_id FOREIGN KEY REFERENCES /*_*/comment(comment_id),
pt_timestamp varchar(14) NOT NULL,
pt_expiry varchar(14) NOT NULL,
- pt_create_perm nvarchar(60) NOT NULL
+ pt_create_perm nvarchar(60) NOT NULL,
+ CONSTRAINT PK_protected_titles PRIMARY KEY(pt_namespace,pt_title)
);
-CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
pp_page int NOT NULL REFERENCES /*_*/page(page_id) ON DELETE CASCADE,
pp_propname nvarchar(60) NOT NULL,
pp_value nvarchar(max) NOT NULL,
- pp_sortkey float DEFAULT NULL
+ pp_sortkey float DEFAULT NULL,
+ CONSTRAINT PK_page_props PRIMARY KEY(pp_page,pp_propname)
);
-CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname);
CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
si_type nvarchar(32) NOT NULL,
-- local key value, ie 'en' or 'wiktionary'
- si_key nvarchar(32) NOT NULL
+ si_key nvarchar(32) NOT NULL,
+
+ CONSTRAINT PK_site_identifiers PRIMARY KEY(si_type, si_key)
);
-CREATE UNIQUE INDEX /*i*/site_ids_type ON /*_*/site_identifiers (si_type, si_key);
CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);
--- /dev/null
+ALTER TABLE interwiki
+ DROP CONSTRAINT interwiki_iw_prefix_key,
+ ADD PRIMARY KEY (iw_prefix);
\ No newline at end of file
--- /dev/null
+DROP INDEX protected_titles_unique;
+ALTER TABLE protected_titles ADD PRIMARY KEY (pt_namespace, pt_title);
\ No newline at end of file
--- /dev/null
+DROP INDEX si_type_key;
+ALTER TABLE site_identifiers ADD PRIMARY KEY (si_type,si_key);
\ No newline at end of file
pp_sortkey FLOAT
);
ALTER TABLE page_props ADD CONSTRAINT page_props_pk PRIMARY KEY (pp_page,pp_propname);
-CREATE INDEX page_props_propname ON page_props (pp_propname);
CREATE UNIQUE INDEX pp_propname_page ON page_props (pp_propname,pp_page);
CREATE INDEX pp_propname_sortkey_page ON page_props (pp_propname, pp_sortkey, pp_page) WHERE (pp_sortkey IS NOT NULL);
CREATE TABLE interwiki (
- iw_prefix TEXT NOT NULL UNIQUE,
+ iw_prefix TEXT NOT NULL PRIMARY KEY,
iw_url TEXT NOT NULL,
iw_local SMALLINT NOT NULL,
iw_trans SMALLINT NOT NULL DEFAULT 0,
pt_reason_id INTEGER NOT NULL DEFAULT 0,
pt_timestamp TIMESTAMPTZ NOT NULL,
pt_expiry TIMESTAMPTZ NULL,
- pt_create_perm TEXT NOT NULL DEFAULT ''
-);
-CREATE UNIQUE INDEX protected_titles_unique ON protected_titles(pt_namespace, pt_title);
+ pt_create_perm TEXT NOT NULL DEFAULT '',
+ PRIMARY KEY (pt_namespace, pt_title)
+);
CREATE TABLE updatelog (
ul_key TEXT NOT NULL PRIMARY KEY,
CREATE TABLE site_identifiers (
si_site INTEGER NOT NULL,
si_type TEXT NOT NULL,
- si_key TEXT NOT NULL
+ si_key TEXT NOT NULL,
+
+ PRIMARY KEY (si_type, si_key)
);
-CREATE UNIQUE INDEX si_type_key ON site_identifiers (si_type, si_key);
CREATE INDEX si_site ON site_identifiers (si_site);
CREATE INDEX si_key ON site_identifiers (si_key);
--- /dev/null
+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;
--- /dev/null
+CREATE TABLE /*_*/page_props_tmp (
+ pp_page int NOT NULL,
+ pp_propname varbinary(60) NOT NULL,
+ pp_value blob NOT NULL,
+ pp_sortkey float DEFAULT NULL,
+
+ PRIMARY KEY (pp_page,pp_propname)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/page_props_tmp
+ SELECT * FROM /*_*/page_props;
+
+DROP TABLE /*_*/page_props;
+
+ALTER TABLE /*_*/page_props_tmp RENAME TO /*_*/page_props;
+
+CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
+CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
\ No newline at end of file
--- /dev/null
+CREATE TABLE /*_*/protected_titles_tmp (
+ pt_namespace int NOT NULL,
+ pt_title varchar(255) binary NOT NULL,
+ pt_user int unsigned NOT NULL,
+ pt_reason varbinary(767) default '', -- Deprecated.
+ pt_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that pt_reason should be used)
+ pt_timestamp binary(14) NOT NULL,
+ pt_expiry varbinary(14) NOT NULL default '',
+ pt_create_perm varbinary(60) NOT NULL,
+
+ PRIMARY KEY (pt_namespace,pt_title)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/protected_titles_tmp
+ SELECT * FROM /*_*/protected_titles;
+
+DROP TABLE /*_*/protected_titles;
+
+ALTER TABLE /*_*/protected_titles_tmp RENAME TO /*_*/protected_titles;
+
+CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
--- /dev/null
+CREATE TABLE /*_*/site_identifiers_tmp (
+ -- Key on site.site_id
+ si_site INT UNSIGNED NOT NULL,
+
+ -- local key type, ie 'interwiki' or 'langlink'
+ si_type varbinary(32) NOT NULL,
+
+ -- local key value, ie 'en' or 'wiktionary'
+ si_key varbinary(32) NOT NULL,
+
+ PRIMARY KEY (si_type, si_key)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/site_identifiers_tmp
+ SELECT * FROM /*_*/site_identifiers;
+
+DROP TABLE /*_*/site_identifiers;
+
+ALTER TABLE /*_*/site_identifiers_tmp RENAME TO /*_*/site_identifiers;
+
+CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
+CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);
\ No newline at end of file
--
CREATE TABLE /*_*/interwiki (
-- The interwiki prefix, (e.g. "Meatball", or the language prefix "de")
- iw_prefix varchar(32) NOT NULL,
+ 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
iw_trans tinyint NOT NULL default 0
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix);
-
--
-- Used for caching expensive grouped queries
pt_reason_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is temporary, signaling that pt_reason should be used)
pt_timestamp binary(14) NOT NULL,
pt_expiry varbinary(14) NOT NULL default '',
- pt_create_perm varbinary(60) NOT NULL
+ pt_create_perm varbinary(60) NOT NULL,
+
+ PRIMARY KEY (pt_namespace,pt_title)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
pp_page int NOT NULL,
pp_propname varbinary(60) NOT NULL,
pp_value blob NOT NULL,
- pp_sortkey float DEFAULT NULL
+ pp_sortkey float DEFAULT NULL,
+
+ PRIMARY KEY (pp_page,pp_propname)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname);
CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
si_type varbinary(32) NOT NULL,
-- local key value, ie 'en' or 'wiktionary'
- si_key varbinary(32) NOT NULL
+ si_key varbinary(32) NOT NULL,
+
+ PRIMARY KEY (si_type, si_key)
) /*$wgDBTableOptions*/;
-CREATE UNIQUE INDEX /*i*/site_ids_type ON /*_*/site_identifiers (si_type, si_key);
CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site);
CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key);