mediawiki-extensions-Echo/db_patches/patch-drop-echo_target_page-etp_user.sqlite.sql
Stephane Bisson b3c07eedeb Remove etp_user
Target page entries used to exist for each user
that was notified for an event. They were
removed as the notifications were marked as read.

Now they remain so that the association between
pages and events can be used for moderation
regardless of the notifications read status.

This patch removes everything about
echo_target_page.etp_user from sql and php code.

Bug: T143959
Change-Id: Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a
2016-09-09 09:32:28 -04:00

27 lines
821 B
SQL

-- Patch to drop unused etp_user
-- give current table temporary name
ALTER TABLE /*_*/echo_target_page RENAME TO /*_*/temp_echo_target_page;
-- recreate table without etp_user
CREATE TABLE /*_*/echo_target_page (
etp_id int unsigned not null primary key auto_increment,
etp_page int unsigned not null default 0,
etp_event int unsigned not null default 0
) /*$wgDBTableOptions*/;
-- copy over old data into new table
INSERT INTO /*_*/echo_target_page
(etp_page, etp_event)
SELECT DISTINCT
etp_page, etp_event
FROM
/*_*/temp_echo_target_page;
-- drop the original table
DROP TABLE /*_*/temp_echo_target_page;
-- recreate indexes
CREATE INDEX /*i*/echo_target_page_event ON /*_*/echo_target_page (etp_event);
CREATE INDEX /*i*/echo_target_page_page_event ON /*_*/echo_target_page (etp_page, etp_event);