2012-04-27 15:14:24 +00:00
-- Database Schema for Echo notification system
CREATE TABLE /* _ */ echo_event (
event_id int unsigned not null primary key auto_increment ,
event_type varchar ( 64 ) binary not null ,
2012-05-18 01:07:30 +00:00
event_variant varchar ( 64 ) binary null ,
2012-04-27 15:14:24 +00:00
event_agent_id int unsigned null , -- The user who triggered it, if any
2013-01-15 23:21:39 +00:00
event_agent_ip varchar ( 39 ) binary null , -- IP address who triggered it, if any
2012-04-27 15:14:24 +00:00
event_page_namespace int unsigned null ,
event_page_title varchar ( 255 ) binary null ,
2013-05-09 18:50:05 +00:00
event_extra BLOB NULL ,
2016-03-04 19:23:02 +00:00
event_page_id int unsigned null ,
event_deleted tinyint unsigned not null default 0
2012-04-27 15:14:24 +00:00
) /* $wgDBTableOptions */ ;
2013-05-20 17:23:51 +00:00
CREATE INDEX /* i */ echo_event_type ON /* _ */ echo_event ( event_type ) ;
2012-04-27 15:14:24 +00:00
CREATE TABLE /* _ */ echo_notification (
notification_event int unsigned not null ,
notification_user int unsigned not null ,
notification_timestamp binary ( 14 ) not null ,
2013-01-15 23:21:39 +00:00
notification_read_timestamp binary ( 14 ) null ,
notification_bundle_base boolean not null default 1 ,
notification_bundle_hash varchar ( 32 ) binary not null , -- The hash for bundling notifications regardless of timestamp
notification_bundle_display_hash varchar ( 32 ) binary not null -- The hash for displaying bundle notifications with regard to timestamp, this is is a subset of notification_bundle_hash
2012-04-27 15:14:24 +00:00
) /* $wgDBTableOptions */ ;
2013-05-20 17:23:51 +00:00
CREATE INDEX /* i */ echo_user_timestamp ON /* _ */ echo_notification ( notification_user , notification_timestamp ) ;
2012-05-17 00:17:03 +00:00
CREATE UNIQUE INDEX /* i */ user_event ON /* _ */ echo_notification ( notification_user , notification_event ) ;
2013-01-15 23:21:39 +00:00
CREATE INDEX /* i */ echo_notification_user_base_read_timestamp ON /* _ */ echo_notification ( notification_user , notification_bundle_base , notification_read_timestamp ) ;
CREATE INDEX /* i */ echo_notification_user_base_timestamp ON /* _ */ echo_notification ( notification_user , notification_bundle_base , notification_timestamp , notification_event ) ;
CREATE INDEX /* i */ echo_notification_user_hash_timestamp ON /* _ */ echo_notification ( notification_user , notification_bundle_hash , notification_timestamp ) ;
CREATE INDEX /* i */ echo_notification_user_hash_base_timestamp ON /* _ */ echo_notification ( notification_user , notification_bundle_display_hash , notification_bundle_base , notification_timestamp ) ;
2016-06-13 19:42:27 +00:00
CREATE INDEX /* i */ echo_notification_event ON /* _ */ echo_notification ( notification_event ) ;
2016-03-04 19:23:02 +00:00
CREATE INDEX /* i */ echo_notification_user_read_timestamp ON /* _ */ echo_notification ( notification_user , notification_read_timestamp ) ;
2012-11-27 01:53:35 +00:00
CREATE TABLE /* _ */ echo_email_batch (
eeb_id int unsigned not null primary key auto_increment ,
eeb_user_id int unsigned not null ,
eeb_event_priority tinyint unsigned not null default 10 , -- event priority
2013-03-06 00:04:48 +00:00
eeb_event_id int unsigned not null ,
eeb_event_hash varchar ( 32 ) binary not null
2012-11-27 01:53:35 +00:00
) /* $wgDBTableOptions */ ;
CREATE UNIQUE INDEX /* i */ echo_email_batch_user_event ON /* _ */ echo_email_batch ( eeb_user_id , eeb_event_id ) ;
2013-03-06 00:04:48 +00:00
CREATE INDEX /* i */ echo_email_batch_user_hash_priority ON /* _ */ echo_email_batch ( eeb_user_id , eeb_event_hash , eeb_event_priority ) ;
2014-08-06 00:16:10 +00:00
CREATE TABLE /* _ */ echo_target_page (
2015-03-16 15:47:13 +00:00
etp_id int unsigned not null primary key auto_increment ,
2014-08-06 00:16:10 +00:00
etp_user int unsigned not null default 0 ,
etp_page int unsigned not null default 0 ,
etp_event int unsigned not null default 0
) /* $wgDBTableOptions */ ;
2015-03-16 15:47:13 +00:00
CREATE INDEX /* i */ echo_target_page_user_event ON /* _ */ echo_target_page ( etp_user , etp_event ) ;
2014-08-06 00:16:10 +00:00
CREATE INDEX /* i */ echo_target_page_user_page_event ON /* _ */ echo_target_page ( etp_user , etp_page , etp_event ) ;
2016-03-04 19:23:02 +00:00
CREATE INDEX /* i */ echo_target_page_page_event ON /* _ */ echo_target_page ( etp_page , etp_event ) ;