This removes most of the pre-CommentStore text columns, and the $wgCommentTableSchemaMigrationStage setting that used to determine whether the columns were used. rev_comment remains in the code, as on Wikimedia wikis the revision table is too large to alter at this time. A future change will combine that with the removal of rev_user_text, rev_content_model, and rev_content_format (and the addition of rev_comment_id and rev_actor). CommentStore's constructor continues to take a $stage parameter, and continues to have the logic for handling it, for the benefit of extensions that might need their own migration process. Bug: T166733 Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
47 lines
2.1 KiB
PL/PgSQL
47 lines
2.1 KiB
PL/PgSQL
--
|
|
-- patch-oldimage-drop-oi_description.sql
|
|
--
|
|
-- T166732. Drop old xx_comment fields, and defaults from xx_comment_id fields.
|
|
|
|
BEGIN;
|
|
|
|
DROP TABLE IF EXISTS /*_*/oldimage_tmp;
|
|
CREATE TABLE /*_*/oldimage_tmp (
|
|
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_id bigint unsigned NOT NULL,
|
|
oi_user int unsigned NOT NULL default 0,
|
|
oi_user_text varchar(255) binary NOT NULL DEFAULT '',
|
|
oi_actor bigint unsigned NOT NULL DEFAULT 0,
|
|
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", "3D") 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_id, oi_user, oi_user_text, oi_actor, 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_id, oi_user, oi_user_text, oi_actor, 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_actor_timestamp ON /*_*/oldimage (oi_actor,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));
|
|
|
|
COMMIT;
|