This removes most of the pre-actor user and user_text columns, and the $wgActorTableSchemaMigrationStage setting that used to determine whether the columns were used. rev_user and rev_user_text remain 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_comment, rev_content_model, and rev_content_format (and the addition of rev_comment_id and rev_actor). ActorMigration'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. Code using ActorMigration for accessing the core fields should be updated to use the new actor fields directly. That will be done for in a followup. Bug: T188327 Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
51 lines
2.1 KiB
PL/PgSQL
51 lines
2.1 KiB
PL/PgSQL
--
|
|
-- patch-ipblocks-drop-ipb_by.sql
|
|
--
|
|
-- T188327. Drop old xx_user and xx_user_text fields, and defaults from xx_actor fields.
|
|
|
|
BEGIN;
|
|
|
|
DROP TABLE IF EXISTS ipblocks_tmp;
|
|
CREATE TABLE /*_*/ipblocks_tmp (
|
|
ipb_id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
ipb_address tinyblob NOT NULL,
|
|
ipb_user int unsigned NOT NULL default 0,
|
|
ipb_by_actor bigint unsigned NOT NULL,
|
|
ipb_reason_id bigint unsigned NOT NULL,
|
|
ipb_timestamp binary(14) NOT NULL default '',
|
|
ipb_auto bool NOT NULL default 0,
|
|
ipb_anon_only bool NOT NULL default 0,
|
|
ipb_create_account bool NOT NULL default 1,
|
|
ipb_enable_autoblock bool NOT NULL default '1',
|
|
ipb_expiry varbinary(14) NOT NULL default '',
|
|
ipb_range_start tinyblob NOT NULL,
|
|
ipb_range_end tinyblob NOT NULL,
|
|
ipb_deleted bool NOT NULL default 0,
|
|
ipb_block_email bool NOT NULL default 0,
|
|
ipb_allow_usertalk bool NOT NULL default 0,
|
|
ipb_parent_block_id int default NULL,
|
|
ipb_sitewide bool NOT NULL default 1
|
|
) /*$wgDBTableOptions*/;
|
|
|
|
INSERT OR IGNORE INTO /*_*/ipblocks_tmp (
|
|
ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id,
|
|
ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
|
|
ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
|
|
ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id, ipb_sitewide
|
|
) SELECT
|
|
ipb_id, ipb_address, ipb_user, ipb_by_actor, ipb_reason_id,
|
|
ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account,
|
|
ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end,
|
|
ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id, ipb_sitewide
|
|
FROM /*_*/ipblocks;
|
|
|
|
DROP TABLE /*_*/ipblocks;
|
|
ALTER TABLE /*_*/ipblocks_tmp RENAME TO /*_*/ipblocks;
|
|
CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
|
|
CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
|
|
CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
|
|
CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
|
|
CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
|
|
CREATE INDEX /*i*/ipb_parent_block_id ON /*_*/ipblocks (ipb_parent_block_id);
|
|
|
|
COMMIT;
|