Tjlsangria has uploaded a new change for review.
https://gerrit.wikimedia.org/r/313670
Change subject: Add primary keys lc_id, oi_id, qc_id, qcc_id, un_id, up_id
......................................................................
Add primary keys lc_id, oi_id, qc_id, qcc_id, un_id, up_id
This adds primary keys for the l10n_cache, oldimage, querycache,
querycachetwo, user_newtalk, and user_properties tables.
Bug: T17441
Change-Id: I4a00e0d59b7d93f8f8a26f6948e4f05cfc69e8f5
---
M includes/installer/MysqlUpdater.php
M includes/installer/OracleUpdater.php
M includes/installer/PostgresUpdater.php
M includes/installer/SqliteUpdater.php
A maintenance/archives/patch-l10n_cache-lc_id.sql
A maintenance/archives/patch-oldimage-oi_id.sql
A maintenance/archives/patch-querycache-qc_id.sql
A maintenance/archives/patch-querycachetwo-qcc_id.sql
A maintenance/archives/patch-user_newtalk-un_id.sql
A maintenance/archives/patch-user_properties-up_id.sql
M maintenance/mssql/tables.sql
M maintenance/oracle/tables.sql
M maintenance/postgres/tables.sql
A maintenance/sqlite/archives/patch-l10n_cache-lc_id.sql
A maintenance/sqlite/archives/patch-oldimage-oi_id.sql
A maintenance/sqlite/archives/patch-querycache-qc_id.sql
A maintenance/sqlite/archives/patch-querycachetwo-qcc_id.sql
A maintenance/sqlite/archives/patch-user_newtalk-un_id.sql
A maintenance/sqlite/archives/patch-user_properties-up_id.sql
M maintenance/tables.sql
20 files changed, 286 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/70/313670/1
diff --git a/includes/installer/MysqlUpdater.php
b/includes/installer/MysqlUpdater.php
index 693b6ff..f1cf7cd 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -288,6 +288,12 @@
'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
[ 'doRevisionPageRevIndexNonUnique' ],
[ 'doNonUniquePlTlIl' ],
+ [ 'addField', 'l10n_cache', 'lc_id',
'patch-l10n_cache-lc_id.sql' ],
+ [ 'addField', 'oldimage', 'oi_id',
'patch-oldimage-oi_id.sql' ],
+ [ 'addField', 'querycache', 'qc_id',
'patch-querycache-qc_id.sql' ],
+ [ 'addField', 'querycachetwo', 'qcc_id',
'patch-querycachetwo-qcc_id.sql' ],
+ [ 'addField', 'user_newtalk', 'un_id',
'patch-user_newtalk-un_id.sql' ],
+ [ 'addField', 'user_properties', 'up_id',
'patch-user_properties-up_id.sql' ],
];
}
diff --git a/includes/installer/OracleUpdater.php
b/includes/installer/OracleUpdater.php
index 8075aac..8cd9acb 100644
--- a/includes/installer/OracleUpdater.php
+++ b/includes/installer/OracleUpdater.php
@@ -116,6 +116,12 @@
// 1.28
[ 'addIndex', 'recentchanges',
'rc_name_type_patrolled_timestamp',
'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
+ [ 'addField', 'l10n_cache', 'lc_id',
'patch-l10n_cache-lc_id.sql' ],
+ [ 'addField', 'oldimage', 'oi_id',
'patch-oldimage-oi_id.sql' ],
+ [ 'addField', 'querycache', 'qc_id',
'patch-querycache-qc_id.sql' ],
+ [ 'addField', 'querycachetwo', 'qcc_id',
'patch-querycachetwo-qcc_id.sql' ],
+ [ 'addField', 'user_newtalk', 'un_id',
'patch-user_newtalk-un_id.sql' ],
+ [ 'addField', 'user_properties', 'up_id',
'patch-user_properties-up_id.sql' ],
// KEEP THIS AT THE BOTTOM!!
[ 'doRebuildDuplicateFunction' ],
diff --git a/includes/installer/PostgresUpdater.php
b/includes/installer/PostgresUpdater.php
index be94d91..e2a7641 100644
--- a/includes/installer/PostgresUpdater.php
+++ b/includes/installer/PostgresUpdater.php
@@ -68,6 +68,12 @@
[ 'addSequence', 'archive', false, 'archive_ar_id_seq'
],
[ 'addSequence', 'externallinks', false,
'externallinks_el_id_seq' ],
[ 'addSequence', 'watchlist', false,
'watchlist_wl_id_seq' ],
+ [ 'addSequence', 'l10n_cache', false,
'archive_lc_id_seq' ],
+ [ 'addSequence', 'oldimage', false,
'oldimage_oi_id_seq' ],
+ [ 'addSequence', 'querycache', false,
'querycache_qc_id_seq' ],
+ [ 'addSequence', 'querycachetwo', false,
'querycachetwo_qcc_id_seq' ],
+ [ 'addSequence', 'user_newtalk', false,
'user_newtalk_un_id_seq' ],
+ [ 'addSequence', 'user_properties', false,
'user_properties_up_id_seq' ],
# new tables
[ 'addTable', 'category', 'patch-category.sql' ],
@@ -168,6 +174,18 @@
"INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('archive_ar_id_seq')" ],
[ 'addPgField', 'externallinks', 'el_id',
"INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('externallinks_el_id_seq')" ],
+ [ 'addPgField', 'l10n_cache', 'lc_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('l10n_cache_lc_id_seq')" ],
+ [ 'addPgField', 'oldimage', 'oi_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('oldimage_oi_id_seq')" ],
+ [ 'addPgField', 'querycache', 'qc_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('querycache_qc_id_seq')" ],
+ [ 'addPgField', 'querycachetwo', 'qcc_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('querycachetwo_qcc_id_seq')" ],
+ [ 'addPgField', 'user_newtalk', 'un_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('user_newtalk_un_id_seq')" ],
+ [ 'addPgField', 'user_properties', 'up_id',
+ "INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('user_properties_up_id_seq')" ],
[ 'addPgField', 'uploadstash', 'us_props', "BYTEA" ],
# type changes
diff --git a/includes/installer/SqliteUpdater.php
b/includes/installer/SqliteUpdater.php
index 1c6e6eb..13fb11a 100644
--- a/includes/installer/SqliteUpdater.php
+++ b/includes/installer/SqliteUpdater.php
@@ -156,6 +156,12 @@
// 1.28
[ 'addIndex', 'recentchanges',
'rc_name_type_patrolled_timestamp',
'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
+ [ 'addField', 'l10n_cache', 'lc_id',
'patch-l10n_cache-lc_id.sql' ],
+ [ 'addField', 'oldimage', 'oi_id',
'patch-oldimage-oi_id.sql' ],
+ [ 'addField', 'querycache', 'qc_id',
'patch-querycache-qc_id.sql' ],
+ [ 'addField', 'querycachetwo', 'qcc_id',
'patch-querycachetwo-qcc_id.sql' ],
+ [ 'addField', 'user_newtalk', 'un_id',
'patch-user_newtalk-un_id.sql' ],
+ [ 'addField', 'user_properties', 'up_id',
'patch-user_properties-up_id.sql' ],
];
}
diff --git a/maintenance/archives/patch-l10n_cache-lc_id.sql
b/maintenance/archives/patch-l10n_cache-lc_id.sql
new file mode 100644
index 0000000..88614d0
--- /dev/null
+++ b/maintenance/archives/patch-l10n_cache-lc_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-l10n_cache-lc_id.sql
+--
+-- Bug T146591. Add l10n_cache.lc_id.
+
+ALTER TABLE /*$wgDBprefix*/l10n_cache
+ ADD COLUMN lc_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (lc_id);
diff --git a/maintenance/archives/patch-oldimage-oi_id.sql
b/maintenance/archives/patch-oldimage-oi_id.sql
new file mode 100644
index 0000000..84e7703
--- /dev/null
+++ b/maintenance/archives/patch-oldimage-oi_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-oldimage-oi_id.sql
+--
+-- Bug T146568. Add oldimage.oi_id.
+
+ALTER TABLE /*$wgDBprefix*/oldimage
+ ADD COLUMN oi_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (oi_id);
diff --git a/maintenance/archives/patch-querycache-qc_id.sql
b/maintenance/archives/patch-querycache-qc_id.sql
new file mode 100644
index 0000000..6d147f6
--- /dev/null
+++ b/maintenance/archives/patch-querycache-qc_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-querycache-qc_id.sql
+--
+-- Bug T146571. Add querycache.qc_id.
+
+ALTER TABLE /*$wgDBprefix*/querycache
+ ADD COLUMN qc_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (qc_id);
diff --git a/maintenance/archives/patch-querycachetwo-qcc_id.sql
b/maintenance/archives/patch-querycachetwo-qcc_id.sql
new file mode 100644
index 0000000..597aab8
--- /dev/null
+++ b/maintenance/archives/patch-querycachetwo-qcc_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-querycachetwo-qcc_id.sql
+--
+-- Bug T146586. Add querycachetwo.qcc_id.
+
+ALTER TABLE /*$wgDBprefix*/querycachetwo
+ ADD COLUMN qcc_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (qcc_id);
diff --git a/maintenance/archives/patch-user_newtalk-un_id.sql
b/maintenance/archives/patch-user_newtalk-un_id.sql
new file mode 100644
index 0000000..5684ebb
--- /dev/null
+++ b/maintenance/archives/patch-user_newtalk-un_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-user_newtalk-un_id.sql
+--
+-- Bug T146585. Add user_newtalk.un_id.
+
+ALTER TABLE /*$wgDBprefix*/user_newtalk
+ ADD COLUMN un_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (un_id);
diff --git a/maintenance/archives/patch-user_properties-up_id.sql
b/maintenance/archives/patch-user_properties-up_id.sql
new file mode 100644
index 0000000..0f9226e
--- /dev/null
+++ b/maintenance/archives/patch-user_properties-up_id.sql
@@ -0,0 +1,8 @@
+--
+-- patch-user_properties-up_id.sql
+--
+-- Bug T146570. Add user_properties.up_id.
+
+ALTER TABLE /*$wgDBprefix*/user_properties
+ ADD COLUMN up_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
+ ADD PRIMARY KEY (up_id);
diff --git a/maintenance/mssql/tables.sql b/maintenance/mssql/tables.sql
index ea087a6..a938fa3 100644
--- a/maintenance/mssql/tables.sql
+++ b/maintenance/mssql/tables.sql
@@ -81,6 +81,8 @@
-- of the "you have new messages" box
-- Changed user_id column to user_id to avoid clashing with user_id function
CREATE TABLE /*_*/user_newtalk (
+ -- Primary key
+ un_id int NOT NULL PRIMARY KEY IDENTITY,
user_id INT NOT NULL REFERENCES /*_*/mwuser(user_id) ON DELETE
CASCADE,
user_ip NVARCHAR(40) NOT NULL DEFAULT '',
user_last_timestamp varchar(14) DEFAULT NULL,
@@ -93,6 +95,8 @@
-- replaces old user.user_options nvarchar(max)
--
CREATE TABLE /*_*/user_properties (
+ -- Primary key
+ up_id int NOT NULL PRIMARY KEY IDENTITY,
up_user INT NOT NULL REFERENCES /*_*/mwuser(user_id) ON DELETE CASCADE,
up_property NVARCHAR(255) NOT NULL,
up_value NVARCHAR(MAX),
@@ -621,6 +625,8 @@
-- this table at re-upload time.
--
CREATE TABLE /*_*/oldimage (
+ -- Primary key
+ oi_id int NOT NULL PRIMARY KEY IDENTITY,
-- Base filename: key to image.img_name
-- Not a FK because deleting images removes them from image
oi_name nvarchar(255) NOT NULL default '',
@@ -936,6 +942,8 @@
-- Used for caching expensive grouped queries
--
CREATE TABLE /*_*/querycache (
+ -- Primary key
+ qc_id int NOT NULL PRIMARY KEY IDENTITY,
-- A key name, generally the base name of of the special page.
qc_type nvarchar(32) NOT NULL,
@@ -1112,6 +1120,8 @@
-- Used for caching expensive grouped queries that need two links (for example
double-redirects)
CREATE TABLE /*_*/querycachetwo (
+ -- Primary key
+ qcc_id int NOT NULL PRIMARY KEY IDENTITY,
-- A key name, generally the base name of of the special page.
qcc_type nvarchar(32) NOT NULL,
@@ -1236,6 +1246,8 @@
-- Table for storing localisation data
CREATE TABLE /*_*/l10n_cache (
+ -- Primary key
+ lc_id int NOT NULL PRIMARY KEY IDENTITY,
-- Language code
lc_lang nvarchar(32) NOT NULL,
-- Cache key
diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql
index d9369c9..46dffa7 100644
--- a/maintenance/oracle/tables.sql
+++ b/maintenance/oracle/tables.sql
@@ -46,7 +46,9 @@
ALTER TABLE &mw_prefix.user_former_groups ADD CONSTRAINT
&mw_prefix.user_former_groups_fk1 FOREIGN KEY (ufg_user) REFERENCES
&mw_prefix.mwuser(user_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
CREATE UNIQUE INDEX &mw_prefix.user_former_groups_u01 ON
&mw_prefix.user_former_groups (ufg_user,ufg_group);
+CREATE SEQUENCE user_newtalk_un_id_seq;
CREATE TABLE &mw_prefix.user_newtalk (
+ un_id NUMBER NOT NULL,
user_id NUMBER DEFAULT 0 NOT NULL,
user_ip VARCHAR2(40) NULL,
user_last_timestamp TIMESTAMP(6) WITH TIME ZONE
@@ -55,7 +57,9 @@
CREATE INDEX &mw_prefix.user_newtalk_i01 ON &mw_prefix.user_newtalk (user_id);
CREATE INDEX &mw_prefix.user_newtalk_i02 ON &mw_prefix.user_newtalk (user_ip);
+CREATE SEQUENCE user_properties_up_id_seq;
CREATE TABLE &mw_prefix.user_properties (
+ up_id NUMBER NOT NULL,
up_user NUMBER NOT NULL,
up_property VARCHAR2(255) NOT NULL,
up_value CLOB
@@ -310,7 +314,9 @@
CREATE INDEX &mw_prefix.image_i04 ON &mw_prefix.image (img_sha1);
+CREATE SEQUENCE oldimage_oi_id_seq;
CREATE TABLE &mw_prefix.oldimage (
+ oi_id NUMBER NOT NULL,
oi_name VARCHAR2(255) DEFAULT 0 NOT NULL,
oi_archive_name VARCHAR2(255),
oi_size NUMBER DEFAULT 0 NOT NULL,
@@ -466,7 +472,9 @@
);
CREATE UNIQUE INDEX &mw_prefix.interwiki_u01 ON &mw_prefix.interwiki
(iw_prefix);
+CREATE SEQUENCE querycache_qc_id_seq;
CREATE TABLE &mw_prefix.querycache (
+ qc_id NUMBER NOT NULL,
qc_type VARCHAR2(32) NOT NULL,
qc_value NUMBER DEFAULT 0 NOT NULL,
qc_namespace NUMBER DEFAULT 0 NOT NULL,
@@ -560,7 +568,9 @@
ALTER TABLE &mw_prefix.redirect ADD CONSTRAINT &mw_prefix.redirect_fk1 FOREIGN
KEY (rd_from) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE
INITIALLY DEFERRED;
CREATE INDEX &mw_prefix.redirect_i01 ON &mw_prefix.redirect
(rd_namespace,rd_title,rd_from);
+CREATE SEQUENCE querycachetwo_qcc_id_seq;
CREATE TABLE &mw_prefix.querycachetwo (
+ qcc_id NUMBER NOT NULL,
qcc_type VARCHAR2(32) NOT NULL,
qcc_value NUMBER DEFAULT 0 NOT NULL,
qcc_namespace NUMBER DEFAULT 0 NOT NULL,
@@ -655,7 +665,9 @@
CREATE INDEX &mw_prefix.si_title_idx ON &mw_prefix.searchindex(si_title)
INDEXTYPE IS ctxsys.context;
CREATE INDEX &mw_prefix.si_text_idx ON &mw_prefix.searchindex(si_text)
INDEXTYPE IS ctxsys.context;
+CREATE SEQUENCE l10n_cache_lc_id_seq;
CREATE TABLE &mw_prefix.l10n_cache (
+ lc_id NUMBER NOT NULL,
lc_lang varchar2(32) NOT NULL,
lc_key varchar2(255) NOT NULL,
lc_value clob NOT NULL
diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql
index 95c87c0..8ebc211 100644
--- a/maintenance/postgres/tables.sql
+++ b/maintenance/postgres/tables.sql
@@ -25,6 +25,12 @@
DROP SEQUENCE IF EXISTS archive_ar_id_seq CASCADE;
DROP SEQUENCE IF EXISTS externallinks_el_id_seq CASCADE;
DROP SEQUENCE IF EXISTS sites_site_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS l10n_cache_lc_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS oldimage_oi_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS querycache_qc_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS querycachetwo_qcc_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS user_newtalk_un_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS user_properties_up_id_seq CASCADE;
DROP FUNCTION IF EXISTS page_deleted() CASCADE;
DROP FUNCTION IF EXISTS ts2_page_title() CASCADE;
DROP FUNCTION IF EXISTS ts2_page_text() CASCADE;
@@ -67,7 +73,9 @@
);
CREATE UNIQUE INDEX ufg_user_group ON user_former_groups (ufg_user, ufg_group);
+CREATE SEQUENCE user_newtalk_un_id_seq;
CREATE TABLE user_newtalk (
+ un_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('user_newtalk_un_id_seq'),
user_id INTEGER NOT NULL REFERENCES mwuser(user_id) ON
DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
user_ip TEXT NULL,
user_last_timestamp TIMESTAMPTZ
@@ -329,7 +337,9 @@
CREATE INDEX img_timestamp_idx ON image (img_timestamp);
CREATE INDEX img_sha1 ON image (img_sha1);
+CREATE SEQUENCE oldimage_oi_id_seq;
CREATE TABLE oldimage (
+ oi_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('oldimage_oi_id_seq'),
oi_name TEXT NOT NULL,
oi_archive_name TEXT NOT NULL,
oi_size INTEGER NOT NULL,
@@ -472,7 +482,9 @@
);
+CREATE SEQUENCE querycache_qc_id_seq;
CREATE TABLE querycache (
+ qc_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('querycache_qc_id_seq'),
qc_type TEXT NOT NULL,
qc_value INTEGER NOT NULL,
qc_namespace SMALLINT NOT NULL,
@@ -485,7 +497,9 @@
qci_timestamp TIMESTAMPTZ NULL
);
+CREATE SEQUENCE querycachetwo_qcc_id_seq;
CREATE TABLE querycachetwo (
+ qcc_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('querycachetwo_qcc_id_seq'),
qcc_type TEXT NOT NULL,
qcc_value INTEGER NOT NULL DEFAULT 0,
qcc_namespace INTEGER NOT NULL DEFAULT 0,
@@ -679,7 +693,9 @@
vt_tag TEXT NOT NULL PRIMARY KEY
);
+CREATE SEQUENCE user_properties_up_id_seq;
CREATE TABLE user_properties (
+ up_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('user_properties_up_id_seq'),
up_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE CASCADE
DEFERRABLE INITIALLY DEFERRED,
up_property TEXT NOT NULL,
up_value TEXT
@@ -687,7 +703,9 @@
CREATE UNIQUE INDEX user_properties_user_property ON user_properties
(up_user,up_property);
CREATE INDEX user_properties_property ON user_properties (up_property);
+CREATE SEQUENCE l10n_cache_lc_id_seq;
CREATE TABLE l10n_cache (
+ lc_id INTEGER NOT NULL PRIMARY KEY DEFAULT
nextval('l10n_cache_lc_id_seq'),
lc_lang TEXT NOT NULL,
lc_key TEXT NOT NULL,
lc_value BYTEA NOT NULL
diff --git a/maintenance/sqlite/archives/patch-l10n_cache-lc_id.sql
b/maintenance/sqlite/archives/patch-l10n_cache-lc_id.sql
new file mode 100644
index 0000000..2a44894
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-l10n_cache-lc_id.sql
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS /*_*/l10n_cache_tmp;
+
+CREATE TABLE /*$wgDBprefix*/l10n_cache_tmp (
+ lc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ lc_lang varbinary(32) NOT NULL,
+ lc_key varchar(255) NOT NULL,
+ lc_value mediumblob NOT NULL
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/l10n_cache_tmp (
+ lc_lang, lc_key, lc_value )
+ SELECT
+ lc_lang, lc_key, lc_value
+ FROM /*_*/l10n_cache;
+
+DROP TABLE /*_*/l10n_cache;
+
+ALTER TABLE /*_*/l10n_cache_tmp RENAME TO /*_*/l10n_cache;
+
+CREATE INDEX /*i*/lc_lang_key ON /*_*/l10n_cache (lc_lang, lc_key);
\ No newline at end of file
diff --git a/maintenance/sqlite/archives/patch-oldimage-oi_id.sql
b/maintenance/sqlite/archives/patch-oldimage-oi_id.sql
new file mode 100644
index 0000000..e671710
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-oldimage-oi_id.sql
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS /*_*/oldimage_tmp;
+
+CREATE TABLE /*$wgDBprefix*/oldimage_tmp (
+ oi_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ oi_name varchar(255) binary NOT NULL default '',
+ oi_archive_name varchar(255) binary NOT NULL default '',
+ oi_size int unsigned NOT NULL default 0,
+ oi_width int NOT NULL default 0,
+ oi_height int NOT NULL default 0,
+ oi_bits int NOT NULL default 0,
+ oi_description varbinary(767) NOT NULL,
+ oi_user int unsigned NOT NULL default 0,
+ oi_user_text varchar(255) binary NOT NULL,
+ oi_timestamp binary(14) NOT NULL default '',
+ oi_metadata mediumblob NOT NULL,
+ oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO",
"MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
+ oi_major_mime ENUM("unknown", "application", "audio", "image", "text",
"video", "message", "model", "multipart", "chemical") NOT NULL default
"unknown",
+ oi_minor_mime varbinary(100) NOT NULL default "unknown",
+ oi_deleted tinyint unsigned NOT NULL default 0,
+ oi_sha1 varbinary(32) NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/oldimage_tmp (
+ oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
+ oi_media_type, oi_major_mime_, oi_minor_mime, oi_deleted, oi_sha1 )
+ SELECT
+ oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits,
oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata,
+ oi_media_type, oi_major_mime_, oi_minor_mime, oi_deleted, oi_sha1
+ FROM /*_*/oldimage;
+
+DROP TABLE /*_*/oldimage;
+
+ALTER TABLE /*_*/oldimage_tmp RENAME TO /*_*/oldimage;
+
+CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage
(oi_user_text,oi_timestamp);
+CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
+CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage
(oi_name,oi_archive_name(14));
+CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1(10));
\ No newline at end of file
diff --git a/maintenance/sqlite/archives/patch-querycache-qc_id.sql
b/maintenance/sqlite/archives/patch-querycache-qc_id.sql
new file mode 100644
index 0000000..c77ad45
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-querycache-qc_id.sql
@@ -0,0 +1,22 @@
+DROP TABLE IF EXISTS /*_*/querycache_tmp;
+
+CREATE TABLE /*$wgDBprefix*/querycache_tmp (
+ qc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ qc_type varbinary(32) NOT NULL,
+ qc_value int unsigned NOT NULL default 0,
+ qc_namespace int NOT NULL default 0,
+ qc_title varchar(255) binary NOT NULL default ''
+) /*$wgDBTableOptions*/;
+);
+
+INSERT OR IGNORE INTO /*_*/querycache_tmp (
+ qc_type, qc_value, qc_namespace, qc_title )
+ SELECT
+ qc_type, qc_value, qc_namespace, qc_title
+ FROM /*_*/querycache;
+
+DROP TABLE /*_*/querycache;
+
+ALTER TABLE /*_*/querycache_tmp RENAME TO /*_*/querycache;
+
+CREATE INDEX /*i*/qc_type ON /*_*/querycache (qc_type,qc_value);
\ No newline at end of file
diff --git a/maintenance/sqlite/archives/patch-querycachetwo-qcc_id.sql
b/maintenance/sqlite/archives/patch-querycachetwo-qcc_id.sql
new file mode 100644
index 0000000..7427c21
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-querycachetwo-qcc_id.sql
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS /*_*/querycachetwo_tmp;
+
+CREATE TABLE /*$wgDBprefix*/querycachetwo_tmp (
+ qcc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ qcc_type varbinary(32) NOT NULL,
+ qcc_value int unsigned NOT NULL default 0,
+ qcc_namespace int NOT NULL default 0,
+ qcc_title varchar(255) binary NOT NULL default '',
+ qcc_namespacetwo int NOT NULL default 0,
+ qcc_titletwo varchar(255) binary NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/querycachetwo_tmp (
+ qcc_type, qcc_value, qcc_namespace, qcc_title, qcc_namespacetwo,
qcc_titletwo )
+ SELECT
+ qcc_type, qcc_value, qcc_namespace, qcc_title, qcc_namespacetwo,
qcc_titletwo
+ FROM /*_*/querycachetwo;
+
+DROP TABLE /*_*/querycachetwo;
+
+ALTER TABLE /*_*/querycachetwo_tmp RENAME TO /*_*/querycachetwo;
+
+CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
+CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo
(qcc_type,qcc_namespace,qcc_title);
+CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo
(qcc_type,qcc_namespacetwo,qcc_titletwo);
\ No newline at end of file
diff --git a/maintenance/sqlite/archives/patch-user_newtalk-un_id.sql
b/maintenance/sqlite/archives/patch-user_newtalk-un_id.sql
new file mode 100644
index 0000000..3613d51
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-user_newtalk-un_id.sql
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS /*_*/user_newtalk_tmp;
+
+CREATE TABLE /*$wgDBprefix*/user_newtalk_tmp (
+ un_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ user_id int unsigned NOT NULL default 0,
+ user_ip varbinary(40) NOT NULL default '',
+ user_last_timestamp varbinary(14) NULL default NULL
+);
+
+INSERT OR IGNORE INTO /*_*/user_newtalk_tmp (
+ user_id, user_ip, user_last_timestamp )
+ SELECT
+ user_id, user_ip, user_last_timestamp
+ FROM /*_*/user_newtalk;
+
+DROP TABLE /*_*/user_newtalk;
+
+ALTER TABLE /*_*/user_newtalk_tmp RENAME TO /*_*/user_newtalk;
+
+CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
+CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
\ No newline at end of file
diff --git a/maintenance/sqlite/archives/patch-user_properties-up_id.sql
b/maintenance/sqlite/archives/patch-user_properties-up_id.sql
new file mode 100644
index 0000000..253dc67
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-user_properties-up_id.sql
@@ -0,0 +1,21 @@
+DROP TABLE IF EXISTS /*_*/user_properties_tmp;
+
+CREATE TABLE /*$wgDBprefix*/user_properties_tmp (
+ up_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ up_user int NOT NULL,
+ up_property varbinary(255) NOT NULL,
+ up_value blob
+) /*$wgDBTableOptions*/;
+
+INSERT OR IGNORE INTO /*_*/user_properties_tmp (
+ up_user, up_property, up_value )
+ SELECT
+ up_user, up_property, up_value
+ FROM /*_*/user_properties;
+
+DROP TABLE /*_*/user_properties;
+
+ALTER TABLE /*_*/user_properties_tmp RENAME TO /*_*/user_properties;
+
+CREATE UNIQUE INDEX /*i*/user_properties_user_property ON /*_*/user_properties
(up_user,up_property);
+CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties
(up_property);
\ No newline at end of file
diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index b5c14e3..ce0731f 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -182,6 +182,8 @@
-- of the "you have new messages" box
--
CREATE TABLE /*_*/user_newtalk (
+ -- Primary key
+ un_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- Key to user.user_id
user_id int unsigned NOT NULL default 0,
-- If the user is an anonymous user their IP address is stored here
@@ -207,6 +209,9 @@
-- saved options since it's a sane table structure.
--
CREATE TABLE /*_*/user_properties (
+ -- Primary key
+ up_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+
-- Foreign key to user.user_id
up_user int NOT NULL,
@@ -903,6 +908,8 @@
-- this table at re-upload time.
--
CREATE TABLE /*_*/oldimage (
+ -- Primary key
+ oi_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- Base filename: key to image.img_name
oi_name varchar(255) binary NOT NULL default '',
@@ -1219,6 +1226,8 @@
-- Used for caching expensive grouped queries
--
CREATE TABLE /*_*/querycache (
+ -- Primary key
+ qc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- A key name, generally the base name of of the special page.
qc_type varbinary(32) NOT NULL,
@@ -1392,6 +1401,8 @@
-- Used for caching expensive grouped queries that need two links (for example
double-redirects)
CREATE TABLE /*_*/querycachetwo (
+ -- Primary key
+ qcc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- A key name, generally the base name of of the special page.
qcc_type varbinary(32) NOT NULL,
@@ -1515,6 +1526,8 @@
-- Table for storing localisation data
CREATE TABLE /*_*/l10n_cache (
+ -- Primary key
+ lc_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- Language code
lc_lang varbinary(32) NOT NULL,
-- Cache key
--
To view, visit https://gerrit.wikimedia.org/r/313670
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a00e0d59b7d93f8f8a26f6948e4f05cfc69e8f5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tjlsangria <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits