mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
[ticket/11103] Create schema files with notification tables
PHPBB3-11103
This commit is contained in:
parent
33371effc4
commit
fa605402f7
@ -618,6 +618,38 @@ BEGIN
|
||||
END;;
|
||||
|
||||
|
||||
# Table: 'phpbb_notifications'
|
||||
CREATE TABLE phpbb_notifications (
|
||||
notification_id INTEGER NOT NULL,
|
||||
item_type VARCHAR(25) 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,
|
||||
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 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,
|
||||
@ -1201,6 +1233,19 @@ 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(25) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||
item_id INTEGER DEFAULT 0 NOT NULL,
|
||||
user_id INTEGER DEFAULT 0 NOT NULL,
|
||||
method VARCHAR(25) CHARACTER SET NONE DEFAULT '' 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);;
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
group_id INTEGER DEFAULT 0 NOT NULL,
|
||||
|
@ -751,6 +751,47 @@ CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_notifications'
|
||||
*/
|
||||
CREATE TABLE [phpbb_notifications] (
|
||||
[notification_id] [int] IDENTITY (1, 1) NOT NULL ,
|
||||
[item_type] [varchar] (25) 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 ,
|
||||
[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
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_poll_options'
|
||||
*/
|
||||
@ -1110,7 +1151,7 @@ CREATE TABLE [phpbb_reports] (
|
||||
[report_closed] [int] DEFAULT (0) NOT NULL ,
|
||||
[report_time] [int] DEFAULT (0) NOT NULL ,
|
||||
[report_text] [text] DEFAULT ('') NOT NULL ,
|
||||
[reported_post_text] [text] DEFAULT ('') NOT NULL
|
||||
[reported_post_text] [text] DEFAULT ('') NOT NULL
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
@ -1474,6 +1515,34 @@ CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_notifications'
|
||||
*/
|
||||
CREATE TABLE [phpbb_user_notifications] (
|
||||
[item_type] [varchar] (25) DEFAULT ('') NOT NULL ,
|
||||
[item_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[user_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[method] [varchar] (25) DEFAULT ('') 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
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
*/
|
||||
|
@ -430,6 +430,26 @@ CREATE TABLE phpbb_modules (
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_notifications'
|
||||
CREATE TABLE phpbb_notifications (
|
||||
notification_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
item_type varbinary(25) 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,
|
||||
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)
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_poll_options'
|
||||
CREATE TABLE phpbb_poll_options (
|
||||
poll_option_id tinyint(4) DEFAULT '0' NOT NULL,
|
||||
@ -849,6 +869,18 @@ CREATE TABLE phpbb_topics_watch (
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_user_notifications'
|
||||
CREATE TABLE phpbb_user_notifications (
|
||||
item_type varbinary(25) DEFAULT '' NOT NULL,
|
||||
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
method varbinary(25) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (item_type, item_id, user_id, method),
|
||||
KEY it (item_type),
|
||||
KEY uid (user_id)
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
|
@ -430,6 +430,26 @@ 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(25) 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,
|
||||
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)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
# Table: 'phpbb_poll_options'
|
||||
CREATE TABLE phpbb_poll_options (
|
||||
poll_option_id tinyint(4) DEFAULT '0' NOT NULL,
|
||||
@ -849,6 +869,18 @@ CREATE TABLE phpbb_topics_watch (
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
# Table: 'phpbb_user_notifications'
|
||||
CREATE TABLE phpbb_user_notifications (
|
||||
item_type varchar(25) DEFAULT '' NOT NULL,
|
||||
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
method varchar(25) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (item_type, item_id, user_id, method),
|
||||
KEY it (item_type),
|
||||
KEY uid (user_id)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
|
@ -840,6 +840,51 @@ END;
|
||||
/
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_notifications'
|
||||
*/
|
||||
CREATE TABLE phpbb_notifications (
|
||||
notification_id number(8) NOT NULL,
|
||||
item_type varchar2(25) 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,
|
||||
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 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'
|
||||
*/
|
||||
@ -1589,6 +1634,23 @@ 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 varchar2(25) DEFAULT '' ,
|
||||
item_id number(8) DEFAULT '0' NOT NULL,
|
||||
user_id number(8) DEFAULT '0' NOT NULL,
|
||||
method varchar2(25) DEFAULT '' ,
|
||||
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)
|
||||
/
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
*/
|
||||
|
@ -596,6 +596,30 @@ 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 SEQUENCE phpbb_notifications_seq;
|
||||
|
||||
CREATE TABLE phpbb_notifications (
|
||||
notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'),
|
||||
item_type varchar(25) 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),
|
||||
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);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_poll_options'
|
||||
*/
|
||||
@ -1093,6 +1117,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(25) 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(25) DEFAULT '' NOT NULL,
|
||||
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);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
*/
|
||||
|
@ -417,6 +417,25 @@ 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(25) 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',
|
||||
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);
|
||||
|
||||
# Table: 'phpbb_poll_options'
|
||||
CREATE TABLE phpbb_poll_options (
|
||||
poll_option_id tinyint(4) NOT NULL DEFAULT '0',
|
||||
@ -823,6 +842,18 @@ 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(25) NOT NULL DEFAULT '',
|
||||
item_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
method varchar(25) NOT NULL DEFAULT '',
|
||||
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);
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
group_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
|
Loading…
x
Reference in New Issue
Block a user