mediawiki-extensions-Echo/echo.sql
Andrew Garrett 6ff170cada Echo: Implement advanced notifications for vanilla talk pages.
Uses the class EchoDiscussionParser to understand actions taken on
vanilla MediaWiki discussion pages.

Currently notifies on these occasions:
* A new comment is added to a discussion on your talk page or that
  you have participated in.
* A new topic is added to your talk page.

There are vague plans to expand to these classes of events:
* Your comment is edited or removed.
* A large section is moved to your talk page.

and these classes of users:
* Users watching discussion pages.

Change-Id: Ie6cae76ed2e0ecf607059e39ac1aa480a275ec89
2012-08-01 10:17:36 -07:00

38 lines
1.7 KiB
SQL

-- Database Schema for Echo notification system
CREATE TABLE /*_*/echo_subscription (
sub_user int unsigned not null,
sub_event_type varchar(64) binary not null,
sub_page_namespace int unsigned null,
sub_page_title varchar(255) binary null,
sub_notify_type varchar(64) binary not null,
sub_enabled tinyint(1) unsigned not null default 1
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/user_subscriptions ON /*_*/echo_subscription (sub_user,sub_event_type,sub_page_namespace,sub_page_title,sub_notify_type,sub_enabled);
CREATE INDEX /*i*/page_subscriptions ON /*_*/echo_subscription (sub_page_namespace,sub_page_title,sub_event_type,sub_user);
CREATE TABLE /*_*/echo_event (
event_id int unsigned not null primary key auto_increment,
event_timestamp binary(14) not null,
event_type varchar(64) binary not null,
event_variant varchar(64) binary null,
event_agent_id int unsigned null, -- The user who triggered it, if any
event_agent_ip varchar(255) binary null, -- IP address who triggered it, if any
event_page_namespace int unsigned null,
event_page_title varchar(255) binary null,
event_extra BLOB NULL
) /*$wgDBTableOptions*/;
CREATE INDEX /*i*/type_page ON /*_*/echo_event (event_type,event_page_namespace,event_page_title,event_timestamp);
CREATE TABLE /*_*/echo_notification (
notification_event int unsigned not null,
notification_user int unsigned not null,
notification_timestamp binary(14) not null,
notification_read_timestamp binary(14) null
) /*$wgDBTableOptions*/;
CREATE INDEX /*i*/user_timestamp ON /*_*/echo_notification (notification_user,notification_timestamp);
CREATE UNIQUE INDEX /*i*/user_event ON /*_*/echo_notification (notification_user,notification_event);