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
1.9 KiB
PL/PgSQL
47 lines
1.9 KiB
PL/PgSQL
--
|
|
-- patch-archive-drop-ar_comment.sql
|
|
--
|
|
-- T166732. Drop old xx_comment fields, and defaults from xx_comment_id fields.
|
|
|
|
BEGIN;
|
|
|
|
DROP TABLE IF EXISTS /*_*/archive_tmp;
|
|
CREATE TABLE /*_*/archive_tmp (
|
|
ar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
ar_namespace int NOT NULL default 0,
|
|
ar_title varchar(255) binary NOT NULL default '',
|
|
ar_comment_id bigint unsigned NOT NULL,
|
|
ar_user int unsigned NOT NULL default 0,
|
|
ar_user_text varchar(255) binary NOT NULL DEFAULT '',
|
|
ar_actor bigint unsigned NOT NULL DEFAULT 0,
|
|
ar_timestamp binary(14) NOT NULL default '',
|
|
ar_minor_edit tinyint NOT NULL default 0,
|
|
ar_rev_id int unsigned NOT NULL,
|
|
ar_text_id int unsigned NOT NULL DEFAULT 0,
|
|
ar_deleted tinyint unsigned NOT NULL default 0,
|
|
ar_len int unsigned,
|
|
ar_page_id int unsigned,
|
|
ar_parent_id int unsigned default NULL,
|
|
ar_sha1 varbinary(32) NOT NULL default '',
|
|
ar_content_model varbinary(32) DEFAULT NULL,
|
|
ar_content_format varbinary(64) DEFAULT NULL
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
INSERT OR IGNORE INTO /*_*/archive_tmp (
|
|
ar_id, ar_namespace, ar_title, ar_comment_id, ar_user, ar_user_text, ar_actor,
|
|
ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted,
|
|
ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format
|
|
) SELECT
|
|
ar_id, ar_namespace, ar_title, ar_comment_id, ar_user, ar_user_text, ar_actor,
|
|
ar_timestamp, ar_minor_edit, ar_rev_id, ar_text_id, ar_deleted,
|
|
ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format
|
|
FROM /*_*/archive;
|
|
|
|
DROP TABLE /*_*/archive;
|
|
ALTER TABLE /*_*/archive_tmp RENAME TO /*_*/archive;
|
|
CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
|
|
CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
|
|
CREATE INDEX /*i*/ar_actor_timestamp ON /*_*/archive (ar_actor,ar_timestamp);
|
|
CREATE UNIQUE INDEX /*i*/ar_revid_uniq ON /*_*/archive (ar_rev_id);
|
|
|
|
COMMIT;
|