aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/schemas/firebird_schema.sql23
-rw-r--r--phpBB/install/schemas/mssql_schema.sql15
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql14
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql14
-rw-r--r--phpBB/install/schemas/oracle_schema.sql30
-rw-r--r--phpBB/install/schemas/postgres_schema.sql14
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql13
7 files changed, 83 insertions, 40 deletions
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 18ca184c65..92227eb38c 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -642,17 +642,30 @@ END;;
# Table: 'phpbb_notification_types'
CREATE TABLE phpbb_notification_types (
- notification_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ notification_type_id INTEGER NOT NULL,
+ notification_type_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
notification_type_enabled INTEGER DEFAULT 1 NOT NULL
);;
-ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type, notification_type_enabled);;
+ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type_id);;
+
+CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types(notification_type_name);;
+
+CREATE GENERATOR phpbb_notification_types_gen;;
+SET GENERATOR phpbb_notification_types_gen TO 0;;
+
+CREATE TRIGGER t_phpbb_notification_types FOR phpbb_notification_types
+BEFORE INSERT
+AS
+BEGIN
+ NEW.notification_type_id = GEN_ID(phpbb_notification_types_gen, 1);
+END;;
# Table: 'phpbb_notifications'
CREATE TABLE phpbb_notifications (
notification_id INTEGER NOT NULL,
- item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ notification_type_id INTEGER DEFAULT 0 NOT NULL,
item_id INTEGER DEFAULT 0 NOT NULL,
item_parent_id INTEGER DEFAULT 0 NOT NULL,
user_id INTEGER DEFAULT 0 NOT NULL,
@@ -663,7 +676,7 @@ CREATE TABLE phpbb_notifications (
ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);;
-CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(item_type, item_id);;
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(notification_type_id, item_id);;
CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);;
CREATE GENERATOR phpbb_notifications_gen;;
@@ -1290,7 +1303,7 @@ 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,
+ notification_type_id INTEGER DEFAULT 0 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,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 3530f9cd25..e869cbd1b5 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -793,7 +793,8 @@ GO
Table: 'phpbb_notification_types'
*/
CREATE TABLE [phpbb_notification_types] (
- [notification_type] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [notification_type_id] [int] IDENTITY (1, 1) NOT NULL ,
+ [notification_type_name] [varchar] (255) DEFAULT ('') NOT NULL ,
[notification_type_enabled] [int] DEFAULT (1) NOT NULL
) ON [PRIMARY]
GO
@@ -801,18 +802,20 @@ GO
ALTER TABLE [phpbb_notification_types] WITH NOCHECK ADD
CONSTRAINT [PK_phpbb_notification_types] PRIMARY KEY CLUSTERED
(
- [notification_type],
- [notification_type_enabled]
+ [notification_type_id]
) ON [PRIMARY]
GO
+CREATE UNIQUE INDEX [type] ON [phpbb_notification_types]([notification_type_name]) ON [PRIMARY]
+GO
+
/*
Table: 'phpbb_notifications'
*/
CREATE TABLE [phpbb_notifications] (
[notification_id] [int] IDENTITY (1, 1) NOT NULL ,
- [item_type] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [notification_type_id] [int] DEFAULT (0) NOT NULL ,
[item_id] [int] DEFAULT (0) NOT NULL ,
[item_parent_id] [int] DEFAULT (0) NOT NULL ,
[user_id] [int] DEFAULT (0) NOT NULL ,
@@ -829,7 +832,7 @@ ALTER TABLE [phpbb_notifications] WITH NOCHECK ADD
) ON [PRIMARY]
GO
-CREATE INDEX [item_ident] ON [phpbb_notifications]([item_type], [item_id]) ON [PRIMARY]
+CREATE INDEX [item_ident] ON [phpbb_notifications]([notification_type_id], [item_id]) ON [PRIMARY]
GO
CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY]
@@ -1588,7 +1591,7 @@ GO
Table: 'phpbb_user_notifications'
*/
CREATE TABLE [phpbb_user_notifications] (
- [item_type] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [notification_type_id] [int] DEFAULT (0) NOT NULL ,
[item_id] [int] DEFAULT (0) NOT NULL ,
[user_id] [int] DEFAULT (0) NOT NULL ,
[method] [varchar] (255) DEFAULT ('') NOT NULL ,
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 8c405677a8..70048ea6bd 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -452,16 +452,18 @@ CREATE TABLE phpbb_modules (
# Table: 'phpbb_notification_types'
CREATE TABLE phpbb_notification_types (
- notification_type varbinary(255) DEFAULT '' NOT NULL,
+ notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment,
+ notification_type_name varbinary(255) DEFAULT '' NOT NULL,
notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
- PRIMARY KEY (notification_type, notification_type_enabled)
+ PRIMARY KEY (notification_type_id),
+ UNIQUE type (notification_type_name)
);
# Table: 'phpbb_notifications'
CREATE TABLE phpbb_notifications (
- notification_id mediumint(8) UNSIGNED NOT NULL auto_increment,
- item_type varbinary(255) DEFAULT '' NOT NULL,
+ notification_id int(10) UNSIGNED NOT NULL auto_increment,
+ notification_type_id smallint(4) UNSIGNED DEFAULT '0' 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,
@@ -469,7 +471,7 @@ CREATE TABLE phpbb_notifications (
notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL,
notification_data blob NOT NULL,
PRIMARY KEY (notification_id),
- KEY item_ident (item_type, item_id),
+ KEY item_ident (notification_type_id, item_id),
KEY user (user_id, notification_read)
);
@@ -911,7 +913,7 @@ CREATE TABLE phpbb_topics_watch (
# Table: 'phpbb_user_notifications'
CREATE TABLE phpbb_user_notifications (
- item_type varbinary(255) DEFAULT '' NOT NULL,
+ notification_type_id smallint(4) UNSIGNED DEFAULT '0' 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,
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index cb259aa57d..e5ab9ceafa 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -452,16 +452,18 @@ CREATE TABLE phpbb_modules (
# Table: 'phpbb_notification_types'
CREATE TABLE phpbb_notification_types (
- notification_type varchar(255) DEFAULT '' NOT NULL,
+ notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment,
+ notification_type_name varchar(255) DEFAULT '' NOT NULL,
notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
- PRIMARY KEY (notification_type, notification_type_enabled)
+ PRIMARY KEY (notification_type_id),
+ UNIQUE type (notification_type_name)
) 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,
+ notification_id int(10) UNSIGNED NOT NULL auto_increment,
+ notification_type_id smallint(4) UNSIGNED DEFAULT '0' 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,
@@ -469,7 +471,7 @@ CREATE TABLE phpbb_notifications (
notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL,
notification_data text NOT NULL,
PRIMARY KEY (notification_id),
- KEY item_ident (item_type, item_id),
+ KEY item_ident (notification_type_id, item_id),
KEY user (user_id, notification_read)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
@@ -911,7 +913,7 @@ CREATE TABLE phpbb_topics_watch (
# Table: 'phpbb_user_notifications'
CREATE TABLE phpbb_user_notifications (
- item_type varchar(255) DEFAULT '' NOT NULL,
+ notification_type_id smallint(4) UNSIGNED DEFAULT '0' 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,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 35f05e34cd..b2e7409c7a 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -870,19 +870,37 @@ END;
Table: 'phpbb_notification_types'
*/
CREATE TABLE phpbb_notification_types (
- notification_type varchar2(255) DEFAULT '' ,
+ notification_type_id number(4) NOT NULL,
+ notification_type_name varchar2(255) DEFAULT '' ,
notification_type_enabled number(1) DEFAULT '1' NOT NULL,
- CONSTRAINT pk_phpbb_notification_types PRIMARY KEY (notification_type, notification_type_enabled)
+ CONSTRAINT pk_phpbb_notification_types PRIMARY KEY (notification_type_id),
+ CONSTRAINT u_phpbb_type UNIQUE (notification_type_name)
)
/
+CREATE SEQUENCE phpbb_notification_types_seq
+/
+
+CREATE OR REPLACE TRIGGER t_phpbb_notification_types
+BEFORE INSERT ON phpbb_notification_types
+FOR EACH ROW WHEN (
+ new.notification_type_id IS NULL OR new.notification_type_id = 0
+)
+BEGIN
+ SELECT phpbb_notification_types_seq.nextval
+ INTO :new.notification_type_id
+ FROM dual;
+END;
+/
+
+
/*
Table: 'phpbb_notifications'
*/
CREATE TABLE phpbb_notifications (
- notification_id number(8) NOT NULL,
- item_type varchar2(255) DEFAULT '' ,
+ notification_id number(10) NOT NULL,
+ notification_type_id number(4) DEFAULT '0' NOT NULL,
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,
@@ -893,7 +911,7 @@ CREATE TABLE phpbb_notifications (
)
/
-CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id)
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id)
/
CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read)
/
@@ -1702,7 +1720,7 @@ 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 '' ,
+ notification_type_id number(4) DEFAULT '0' NOT NULL,
item_id number(8) DEFAULT '0' NOT NULL,
user_id number(8) DEFAULT '0' NOT NULL,
method varchar2(255) DEFAULT '' ,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 6dc507b46d..cd6de434b5 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -623,12 +623,16 @@ CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id
/*
Table: 'phpbb_notification_types'
*/
+CREATE SEQUENCE phpbb_notification_types_seq;
+
CREATE TABLE phpbb_notification_types (
- notification_type varchar(255) DEFAULT '' NOT NULL,
+ notification_type_id INT2 DEFAULT nextval('phpbb_notification_types_seq'),
+ notification_type_name varchar(255) DEFAULT '' NOT NULL,
notification_type_enabled INT2 DEFAULT '1' NOT NULL CHECK (notification_type_enabled >= 0),
- PRIMARY KEY (notification_type, notification_type_enabled)
+ PRIMARY KEY (notification_type_id)
);
+CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name);
/*
Table: 'phpbb_notifications'
@@ -637,7 +641,7 @@ CREATE SEQUENCE phpbb_notifications_seq;
CREATE TABLE phpbb_notifications (
notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'),
- item_type varchar(255) DEFAULT '' NOT NULL,
+ notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0),
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),
@@ -647,7 +651,7 @@ CREATE TABLE phpbb_notifications (
PRIMARY KEY (notification_id)
);
-CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id);
CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
/*
@@ -1171,7 +1175,7 @@ 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,
+ notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0),
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,
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index ccb67ad46f..e12bb624b6 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -439,16 +439,17 @@ CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id
# Table: 'phpbb_notification_types'
CREATE TABLE phpbb_notification_types (
- notification_type varchar(255) NOT NULL DEFAULT '',
- notification_type_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1',
- PRIMARY KEY (notification_type, notification_type_enabled)
+ notification_type_id INTEGER PRIMARY KEY NOT NULL ,
+ notification_type_name varchar(255) NOT NULL DEFAULT '',
+ notification_type_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1'
);
+CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name);
# Table: 'phpbb_notifications'
CREATE TABLE phpbb_notifications (
notification_id INTEGER PRIMARY KEY NOT NULL ,
- item_type varchar(255) NOT NULL DEFAULT '',
+ notification_type_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
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',
@@ -457,7 +458,7 @@ CREATE TABLE phpbb_notifications (
notification_data text(65535) NOT NULL DEFAULT ''
);
-CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
+CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id);
CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
# Table: 'phpbb_poll_options'
@@ -883,7 +884,7 @@ 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 '',
+ notification_type_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
item_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
method varchar(255) NOT NULL DEFAULT '',