diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/database_update.php | 123 | ||||
-rw-r--r-- | phpBB/install/schemas/firebird_schema.sql | 53 | ||||
-rw-r--r-- | phpBB/install/schemas/mssql_schema.sql | 81 | ||||
-rw-r--r-- | phpBB/install/schemas/mysql_40_schema.sql | 38 | ||||
-rw-r--r-- | phpBB/install/schemas/mysql_41_schema.sql | 38 | ||||
-rw-r--r-- | phpBB/install/schemas/oracle_schema.sql | 70 | ||||
-rw-r--r-- | phpBB/install/schemas/postgres_schema.sql | 44 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 7 | ||||
-rw-r--r-- | phpBB/install/schemas/sqlite_schema.sql | 39 |
9 files changed, 483 insertions, 10 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index dcdd17cbc0..17135f4a66 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1106,6 +1106,49 @@ function database_update_info() 'ext_name' => array('UNIQUE', 'ext_name'), ), ), + $table_prefix . 'notifications' => array( + 'COLUMNS' => array( + 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'unread' => array('BOOL', 1), + 'is_enabled' => array('BOOL', 1), + 'time' => array('TIMESTAMP', 1), + 'data' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'notification_id', + 'KEYS' => array( + 'item_type' => array('INDEX', 'item_type'), + 'item_id' => array('INDEX', 'item_id'), + 'item_pid' => array('INDEX', 'item_parent_id'), + 'user_id' => array('INDEX', 'user_id'), + 'time' => array('INDEX', 'time'), + 'unread' => array('INDEX', 'unread'), + 'is_enabled' => array('INDEX', 'is_enabled'), + ), + ), + $table_prefix . 'user_notifications' => array( + 'COLUMNS' => array( + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'method' => array('VCHAR:255', ''), + 'notify' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => array( + 'item_type', + 'item_id', + 'user_id', + 'method', + ), + 'KEYS' => array( + 'it' => array('INDEX', 'item_type'), + 'uid' => array('INDEX', 'user_id'), + 'no' => array('INDEX', 'notify'), + ), + ), ), 'add_columns' => array( GROUPS_TABLE => array( @@ -2474,6 +2517,20 @@ function change_database_data(&$no_updates, $version) 'auth' => '', 'cat' => 'UCP_PROFILE', ), + 'notification_options' => array( + 'base' => 'ucp_notifications', + 'class' => 'ucp', + 'title' => 'UCP_NOTIFICATION_OPTIONS', + 'auth' => '', + 'cat' => 'UCP_PREFS', + ), + 'notification_list' => array( + 'base' => 'ucp_notifications', + 'class' => 'ucp', + 'title' => 'UCP_NOTIFICATION_LIST', + 'auth' => '', + 'cat' => 'UCP_MAIN', + ), ); _add_modules($modules_to_install); @@ -2748,6 +2805,72 @@ function change_database_data(&$no_updates, $version) $config->set('site_home_text', ''); } + if (!isset($config['load_notifications'])) + { + $config->set('load_notifications', 1); + + // Convert notifications + $convert_notifications = array( + array( + 'check' => ($config['allow_topic_notify']), + 'item_type' => 'phpbb_notification_type_post', + ), + array( + 'check' => ($config['allow_forum_notify']), + 'item_type' => 'phpbb_notification_type_topic', + ), + array( + 'check' => ($config['allow_bookmarks']), + 'item_type' => 'phpbb_notification_type_bookmark', + ), + array( + 'check' => ($config['allow_privmsg']), + 'item_type' => 'phpbb_notification_type_pm', + ), + ); + + foreach ($convert_notifications as $convert_data) + { + if ($convert_data['check']) + { + $sql = 'SELECT user_id, user_notify_type + FROM ' . USERS_TABLE . ' + WHERE user_notify = 1'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array( + 'item_type' => $convert_data['item_type'], + 'item_id' => 0, + 'user_id' => $row['user_id'], + 'method' => '', + )), $errored, $error_ary); + + if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) + { + _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array( + 'item_type' => $convert_data['item_type'], + 'item_id' => 0, + 'user_id' => $row['user_id'], + 'method' => 'phpbb_notification_method_email', + )), $errored, $error_ary); + } + + if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) + { + _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array( + 'item_type' => $convert_data['item_type'], + 'item_id' => 0, + 'user_id' => $row['user_id'], + 'method' => 'phpbb_notification_method_jabber', + )), $errored, $error_ary); + } + } + $db->sql_freeresult($result); + } + } + } + break; } } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 767ce68b4a..8456958800 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -618,6 +618,40 @@ BEGIN END;; +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id INTEGER NOT NULL, + item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + item_id INTEGER DEFAULT 0 NOT NULL, + item_parent_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + unread INTEGER DEFAULT 1 NOT NULL, + is_enabled INTEGER DEFAULT 1 NOT NULL, + time INTEGER DEFAULT 1 NOT NULL, + data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL +);; + +ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);; + +CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications(item_type);; +CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications(item_id);; +CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications(item_parent_id);; +CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications(user_id);; +CREATE INDEX phpbb_notifications_time ON phpbb_notifications(time);; +CREATE INDEX phpbb_notifications_unread ON phpbb_notifications(unread);; +CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications(is_enabled);; + +CREATE GENERATOR phpbb_notifications_gen;; +SET GENERATOR phpbb_notifications_gen TO 0;; + +CREATE TRIGGER t_phpbb_notifications FOR phpbb_notifications +BEFORE INSERT +AS +BEGIN + NEW.notification_id = GEN_ID(phpbb_notifications_gen, 1); +END;; + + # Table: 'phpbb_poll_options' CREATE TABLE phpbb_poll_options ( poll_option_id INTEGER DEFAULT 0 NOT NULL, @@ -912,8 +946,8 @@ CREATE TABLE phpbb_reports ( report_time INTEGER DEFAULT 0 NOT NULL, report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL + reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, + reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL );; ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; @@ -1203,6 +1237,21 @@ CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + item_id INTEGER DEFAULT 0 NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + notify INTEGER DEFAULT 1 NOT NULL +);; + +ALTER TABLE phpbb_user_notifications ADD PRIMARY KEY (item_type, item_id, user_id, method);; + +CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications(item_type);; +CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications(user_id);; +CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications(notify);; + # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( group_id INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 84c975942f..d0023aa411 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -752,6 +752,51 @@ GO /* + Table: 'phpbb_notifications' +*/ +CREATE TABLE [phpbb_notifications] ( + [notification_id] [int] IDENTITY (1, 1) NOT NULL , + [item_type] [varchar] (255) DEFAULT ('') NOT NULL , + [item_id] [int] DEFAULT (0) NOT NULL , + [item_parent_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [unread] [int] DEFAULT (1) NOT NULL , + [is_enabled] [int] DEFAULT (1) NOT NULL , + [time] [int] DEFAULT (1) NOT NULL , + [data] [varchar] (4000) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_notifications] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_notifications] PRIMARY KEY CLUSTERED + ( + [notification_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [item_type] ON [phpbb_notifications]([item_type]) ON [PRIMARY] +GO + +CREATE INDEX [item_id] ON [phpbb_notifications]([item_id]) ON [PRIMARY] +GO + +CREATE INDEX [item_pid] ON [phpbb_notifications]([item_parent_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_notifications]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [time] ON [phpbb_notifications]([time]) ON [PRIMARY] +GO + +CREATE INDEX [unread] ON [phpbb_notifications]([unread]) ON [PRIMARY] +GO + +CREATE INDEX [is_enabled] ON [phpbb_notifications]([is_enabled]) ON [PRIMARY] +GO + + +/* Table: 'phpbb_poll_options' */ CREATE TABLE [phpbb_poll_options] ( @@ -1111,8 +1156,8 @@ CREATE TABLE [phpbb_reports] ( [report_time] [int] DEFAULT (0) NOT NULL , [report_text] [text] DEFAULT ('') NOT NULL , [reported_post_text] [text] DEFAULT ('') NOT NULL , - [reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL + [reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -1477,6 +1522,38 @@ GO /* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE [phpbb_user_notifications] ( + [item_type] [varchar] (255) DEFAULT ('') NOT NULL , + [item_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [method] [varchar] (255) DEFAULT ('') NOT NULL , + [notify] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_user_notifications] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_user_notifications] PRIMARY KEY CLUSTERED + ( + [item_type], + [item_id], + [user_id], + [method] + ) ON [PRIMARY] +GO + +CREATE INDEX [it] ON [phpbb_user_notifications]([item_type]) ON [PRIMARY] +GO + +CREATE INDEX [uid] ON [phpbb_user_notifications]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [no] ON [phpbb_user_notifications]([notify]) ON [PRIMARY] +GO + + +/* Table: 'phpbb_user_group' */ CREATE TABLE [phpbb_user_group] ( diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 8aab949103..07e529e833 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -430,6 +430,28 @@ CREATE TABLE phpbb_modules ( ); +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id mediumint(8) UNSIGNED NOT NULL auto_increment, + item_type varbinary(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + is_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + time int(11) UNSIGNED DEFAULT '1' NOT NULL, + data blob NOT NULL, + PRIMARY KEY (notification_id), + KEY item_type (item_type), + KEY item_id (item_id), + KEY item_pid (item_parent_id), + KEY user_id (user_id), + KEY time (time), + KEY unread (unread), + KEY is_enabled (is_enabled) +); + + # Table: 'phpbb_poll_options' CREATE TABLE phpbb_poll_options ( poll_option_id tinyint(4) DEFAULT '0' NOT NULL, @@ -649,8 +671,8 @@ CREATE TABLE phpbb_reports ( report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumblob NOT NULL, reported_post_text mediumblob NOT NULL, - reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL, reported_post_uid varbinary(8) DEFAULT '' NOT NULL, + reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) @@ -851,6 +873,20 @@ CREATE TABLE phpbb_topics_watch ( ); +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varbinary(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + method varbinary(255) DEFAULT '' NOT NULL, + notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (item_type, item_id, user_id, method), + KEY it (item_type), + KEY uid (user_id), + KEY no (notify) +); + + # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 04aef2844a..361f53c313 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -430,6 +430,28 @@ CREATE TABLE phpbb_modules ( ) CHARACTER SET `utf8` COLLATE `utf8_bin`; +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id mediumint(8) UNSIGNED NOT NULL auto_increment, + item_type varchar(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + is_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + time int(11) UNSIGNED DEFAULT '1' NOT NULL, + data text NOT NULL, + PRIMARY KEY (notification_id), + KEY item_type (item_type), + KEY item_id (item_id), + KEY item_pid (item_parent_id), + KEY user_id (user_id), + KEY time (time), + KEY unread (unread), + KEY is_enabled (is_enabled) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + # Table: 'phpbb_poll_options' CREATE TABLE phpbb_poll_options ( poll_option_id tinyint(4) DEFAULT '0' NOT NULL, @@ -649,8 +671,8 @@ CREATE TABLE phpbb_reports ( report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumtext NOT NULL, reported_post_text mediumtext NOT NULL, - reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, reported_post_uid varchar(8) DEFAULT '' NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) @@ -851,6 +873,20 @@ CREATE TABLE phpbb_topics_watch ( ) CHARACTER SET `utf8` COLLATE `utf8_bin`; +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) DEFAULT '' NOT NULL, + item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + method varchar(255) DEFAULT '' NOT NULL, + notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (item_type, item_id, user_id, method), + KEY it (item_type), + KEY uid (user_id), + KEY no (notify) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 91f906bc8b..a2bb016dae 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -841,6 +841,54 @@ END; /* + Table: 'phpbb_notifications' +*/ +CREATE TABLE phpbb_notifications ( + notification_id number(8) NOT NULL, + item_type varchar2(255) DEFAULT '' , + item_id number(8) DEFAULT '0' NOT NULL, + item_parent_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + unread number(1) DEFAULT '1' NOT NULL, + is_enabled number(1) DEFAULT '1' NOT NULL, + time number(11) DEFAULT '1' NOT NULL, + data clob DEFAULT '' , + CONSTRAINT pk_phpbb_notifications PRIMARY KEY (notification_id) +) +/ + +CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications (item_type) +/ +CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications (item_id) +/ +CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id) +/ +CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id) +/ +CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time) +/ +CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread) +/ +CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications (is_enabled) +/ + +CREATE SEQUENCE phpbb_notifications_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_notifications +BEFORE INSERT ON phpbb_notifications +FOR EACH ROW WHEN ( + new.notification_id IS NULL OR new.notification_id = 0 +) +BEGIN + SELECT phpbb_notifications_seq.nextval + INTO :new.notification_id + FROM dual; +END; +/ + + +/* Table: 'phpbb_poll_options' */ CREATE TABLE phpbb_poll_options ( @@ -1216,8 +1264,8 @@ CREATE TABLE phpbb_reports ( report_time number(11) DEFAULT '0' NOT NULL, report_text clob DEFAULT '' , reported_post_text clob DEFAULT '' , - reported_post_bitfield varchar2(255) DEFAULT '' , reported_post_uid varchar2(8) DEFAULT '' , + reported_post_bitfield varchar2(255) DEFAULT '' , CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) ) / @@ -1592,6 +1640,26 @@ CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status / /* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE phpbb_user_notifications ( + item_type varchar2(255) DEFAULT '' , + item_id number(8) DEFAULT '0' NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + method varchar2(255) DEFAULT '' , + notify number(1) DEFAULT '1' NOT NULL, + CONSTRAINT pk_phpbb_user_notifications PRIMARY KEY (item_type, item_id, user_id, method) +) +/ + +CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type) +/ +CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id) +/ +CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify) +/ + +/* Table: 'phpbb_user_group' */ CREATE TABLE phpbb_user_group ( diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 619985e0d6..94926d0b7a 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -597,6 +597,32 @@ CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); /* + Table: 'phpbb_notifications' +*/ +CREATE SEQUENCE phpbb_notifications_seq; + +CREATE TABLE phpbb_notifications ( + notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'), + item_type varchar(255) DEFAULT '' NOT NULL, + item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), + item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0), + is_enabled INT2 DEFAULT '1' NOT NULL CHECK (is_enabled >= 0), + time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0), + data varchar(4000) DEFAULT '' NOT NULL, + PRIMARY KEY (notification_id) +); + +CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications (item_type); +CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications (item_id); +CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id); +CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id); +CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time); +CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread); +CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications (is_enabled); + +/* Table: 'phpbb_poll_options' */ CREATE TABLE phpbb_poll_options ( @@ -855,8 +881,8 @@ CREATE TABLE phpbb_reports ( report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), report_text TEXT DEFAULT '' NOT NULL, reported_post_text TEXT DEFAULT '' NOT NULL, - reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, reported_post_uid varchar(8) DEFAULT '' NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (report_id) ); @@ -1096,6 +1122,22 @@ CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); /* + Table: 'phpbb_user_notifications' +*/ +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) DEFAULT '' NOT NULL, + item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), + user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0), + method varchar(255) DEFAULT '' NOT NULL, + notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0), + PRIMARY KEY (item_type, item_id, user_id, method) +); + +CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type); +CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id); +CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify); + +/* Table: 'phpbb_user_group' */ CREATE TABLE phpbb_user_group ( diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index dbb5fd7481..e100a1dc14 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -175,6 +175,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_cdn', INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_notifications', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_guests', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', '5'); @@ -769,4 +770,10 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3'); INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg'); INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm'); +# User Notification Options (for first user) +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, ''); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, 'phpbb_notification_method_email'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, ''); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, 'phpbb_notification_method_email'); + # POSTGRES COMMIT # diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 1690a7dcab..43611ef70b 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -417,6 +417,27 @@ CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); +# Table: 'phpbb_notifications' +CREATE TABLE phpbb_notifications ( + notification_id INTEGER PRIMARY KEY NOT NULL , + item_type varchar(255) NOT NULL DEFAULT '', + item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + item_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + unread INTEGER UNSIGNED NOT NULL DEFAULT '1', + is_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1', + time INTEGER UNSIGNED NOT NULL DEFAULT '1', + data text(65535) NOT NULL DEFAULT '' +); + +CREATE INDEX phpbb_notifications_item_type ON phpbb_notifications (item_type); +CREATE INDEX phpbb_notifications_item_id ON phpbb_notifications (item_id); +CREATE INDEX phpbb_notifications_item_pid ON phpbb_notifications (item_parent_id); +CREATE INDEX phpbb_notifications_user_id ON phpbb_notifications (user_id); +CREATE INDEX phpbb_notifications_time ON phpbb_notifications (time); +CREATE INDEX phpbb_notifications_unread ON phpbb_notifications (unread); +CREATE INDEX phpbb_notifications_is_enabled ON phpbb_notifications (is_enabled); + # Table: 'phpbb_poll_options' CREATE TABLE phpbb_poll_options ( poll_option_id tinyint(4) NOT NULL DEFAULT '0', @@ -630,8 +651,8 @@ CREATE TABLE phpbb_reports ( report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', report_text mediumtext(16777215) NOT NULL DEFAULT '', reported_post_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post_bitfield varchar(255) NOT NULL DEFAULT '', - reported_post_uid varchar(8) NOT NULL DEFAULT '' + reported_post_uid varchar(8) NOT NULL DEFAULT '', + reported_post_bitfield varchar(255) NOT NULL DEFAULT '' ); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); @@ -825,6 +846,20 @@ CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); +# Table: 'phpbb_user_notifications' +CREATE TABLE phpbb_user_notifications ( + item_type varchar(255) NOT NULL DEFAULT '', + item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + method varchar(255) NOT NULL DEFAULT '', + notify INTEGER UNSIGNED NOT NULL DEFAULT '1', + PRIMARY KEY (item_type, item_id, user_id, method) +); + +CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type); +CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id); +CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify); + # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', |