wiki.techinc.nl/maintenance/sqlite/archives/patch-protected_titles-drop-pt_reason.sql
Brad Jorsch 0abb9338f8 Mostly drop old comment schemas
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
2019-02-07 16:59:27 +11:00

30 lines
1,015 B
PL/PgSQL

--
-- patch-protected_titles-drop-pt_reason.sql
--
-- T166732. Drop old xx_comment fields, and defaults from xx_comment_id fields.
BEGIN;
DROP TABLE IF EXISTS /*_*/protected_titles_tmp;
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_id bigint unsigned NOT NULL,
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 OR IGNORE INTO /*_*/protected_titles_tmp (
pt_namespace, pt_title, pt_user, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm
) SELECT
pt_namespace, pt_title, pt_user, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm
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);
COMMIT;