From f2cc5c093dd6a040d7a6ef6a4358dbfe0b70ff88 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 17 Mar 2006 21:02:32 +0000 Subject: [PATCH] Warning changes for the other schema files git-svn-id: file:///svn/phpbb/trunk@5646 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/firebird_schema.sql | 33 ++++++++++++++++++++--- phpBB/install/schemas/mssql_schema.sql | 26 +++++++++++++++++- phpBB/install/schemas/oracle_schema.sql | 30 ++++++++++++++++++++- phpBB/install/schemas/postgres_schema.sql | 14 +++++++++- phpBB/install/schemas/sqlite_schema.sql | 11 +++++++- 5 files changed, 106 insertions(+), 8 deletions(-) diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 268883ddde..f5c8986ee1 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -2,7 +2,6 @@ # Firebird Schema for phpBB 3.x - (c) phpBB Group, 2005 # # $Id$ -# @todo user_last_warning to users table and warnings table # phpbb_attachments CREATE TABLE phpbb_attachments ( @@ -761,6 +760,7 @@ CREATE TABLE phpbb_users ( user_lastpage VARCHAR(100) NOT NULL, user_last_confirm_key VARCHAR(10) NOT NULL, user_warnings INTEGER DEFAULT 0 NOT NULL, + user_last_warning INTEGER DEFAULT 0 NOT NULL, user_login_attempts INTEGER DEFAULT 0 NOT NULL, user_posts INTEGER DEFAULT 0 NOT NULL, user_lang VARCHAR(30) NOT NULL, @@ -813,6 +813,15 @@ CREATE TABLE phpbb_users ( user_newpasswd VARCHAR(32) NOT NULL );; +# phpbb_warnings +CREATE TABLE phpbb_warnings ( + warning_id INTEGER NOT NULL, + user_id INTEGER DEFAULT 0 NOT NULL, + post_id INTEGER DEFAULT 0 NOT NULL, + log_id INTEGER DEFAULT 0 NOT NULLL, + warning_time INTEGER DEFAULT 0 NOT NULL, +);; + # phpbb_words CREATE TABLE phpbb_words ( word_id INTEGER NOT NULL, @@ -1447,6 +1456,11 @@ ON phpbb_users( username );; +ALTER TABLE phpbb_warnings +ADD PRIMARY KEY ( + warning_id +);; + ALTER TABLE phpbb_words ADD PRIMARY KEY ( word_id @@ -1601,9 +1615,13 @@ CREATE GENERATOR G_phpbb_usersuser_idGen31;; SET GENERATOR G_phpbb_usersuser_idGen31 TO 0;; -CREATE GENERATOR G_phpbb_wordsword_idGen32;; +CREATE GENERATOR G_phpbb_warningswarning_idGen32;; -SET GENERATOR G_phpbb_wordsword_idGen32 TO 0;; +SET GENERATOR G_phpbb_warningswarning_idGen32 TO 0;; + +CREATE GENERATOR G_phpbb_wordsword_idGen33;; + +SET GENERATOR G_phpbb_wordsword_idGen33 TO 0;; CREATE TRIGGER tG_phpbb_attachmentsattach_idGe FOR phpbb_attachments BEFORE INSERT @@ -1829,9 +1847,16 @@ BEGIN NEW.user_id = GEN_ID(G_phpbb_usersuser_idGen31, 1); END;; +CREATE TRIGGER GetNextG_phpbb_warningswarning_idGen3 FOR phpbb_warnings +BEFORE INSERT +AS +BEGIN + NEW.warning_id = GEN_ID(G_phpbb_warningswarning_idGen32, 1); +END;; + CREATE TRIGGER GetNextG_phpbb_wordsword_idGen3 FOR phpbb_words BEFORE INSERT AS BEGIN - NEW.word_id = GEN_ID(G_phpbb_wordsword_idGen32, 1); + NEW.word_id = GEN_ID(G_phpbb_wordsword_idGen33, 1); END;; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index c2e9ae2c46..1f41d0ead3 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -3,7 +3,6 @@ MSSQL Schema for phpBB 3.x - (c) phpBB Group, 2005 $Id$ -@todo user_last_warning to users table and warnings table */ @@ -767,6 +766,7 @@ CREATE TABLE [phpbb_users] ( [user_lastpage] [varchar] (100) NOT NULL , [user_last_confirm_key] [varchar] (10) NOT NULL , [user_warnings] [int] NOT NULL , + [user_last_warning] [int] NOT NULL , [user_login_attempts] [int] NOT NULL , [user_posts] [int] NOT NULL , [user_lang] [varchar] (30) NOT NULL , @@ -818,6 +818,15 @@ CREATE TABLE [phpbb_users] ( ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO +CREATE TABLE [phpbb_warnings] ( + [warning_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] NOT NULL , + [post_id] [int] NOT NULL , + [log_id] [int] NOT NULL , + [warning_time] [int] NOT NULL +) ON [PRIMARY] +GO + CREATE TABLE [phpbb_words] ( [word_id] [int] IDENTITY (1, 1) NOT NULL , [word] [varchar] (100) NOT NULL , @@ -1173,6 +1182,13 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD ) ON [PRIMARY] GO +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED + ( + [warning_id] + ) ON [PRIMARY] +GO + ALTER TABLE [phpbb_words] WITH NOCHECK ADD CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED ( @@ -1613,6 +1629,7 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD CONSTRAINT [DF_users__user_lastmark] DEFAULT (0) FOR [user_lastmark], CONSTRAINT [DF_users__user_lastpost_time] DEFAULT (0) FOR [user_lastpost_time], CONSTRAINT [DF_users__user_warnings] DEFAULT (0) FOR [user_warnings], + CONSTRAINT [DF_users__user_last_warning] DEFAULT (0) FOR [user_last_warning], CONSTRAINT [DF_users__user_login_attempts] DEFAULT (0) FOR [user_login_attempts], CONSTRAINT [DF_users__user_posts] DEFAULT (0) FOR [user_posts], CONSTRAINT [DF_users__user_timezone] DEFAULT (0) FOR [user_timezone], @@ -1647,6 +1664,13 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD CONSTRAINT [DF_users__user_sig_bbcode_bitf] DEFAULT (0) FOR [user_sig_bbcode_bitfield] GO +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [DF_warnings__user_id] DEFAULT (0) FOR [user_id], + CONSTRAINT [DF_warnings__post_id] DEFAULT (0) FOR [post_id], + CONSTRAINT [DF_warnings__log_id] DEFAULT (0) FOR [log_id], + CONSTRAINT [DF_warnings__warning_time] DEFAULT (0) FOR [warning_time] +GO + ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD CONSTRAINT [DF_zebra__user_id] DEFAULT (0) FOR [user_id], CONSTRAINT [DF_zebra__zebra_id] DEFAULT (0) FOR [zebra_id], diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index f579cde90d..25ffabbb32 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -2,7 +2,6 @@ Oracle Schema for phpBB 3.x - (c) phpBB Group, 2005 $Id$ -@todo user_last_warning to users table and warnings table */ /* @@ -1667,6 +1666,7 @@ CREATE TABLE phpbb_users ( user_lastpage varchar2(100) DEFAULT '', user_last_confirm_key varchar2(10) DEFAULT '', user_warnings number(4) DEFAULT '0' NOT NULL, + user_last_warning number(11) DEFAULT '0' NOT NULL, user_login_attempts number(4) DEFAULT '0' NOT NULL, user_posts number(8) DEFAULT '0' NOT NULL, user_lang varchar2(30) DEFAULT '', @@ -1741,6 +1741,34 @@ CREATE INDEX user_email_hash on phpbb_users (user_email_hash) CREATE INDEX username on phpbb_users (username) / +/* + Table: phpbb_warnings +*/ +CREATE TABLE phpbb_warnings ( + warning_id number(8) NOT NULL, + user_id number(8) DEFAULT '0' NOT NULL, + post_id number(8) DEFAULT '0' NOT NULL, + log_id number(8) DEFAULT '0' NOT NULL, + warning_time number(11) DEFAULT '0' NOT NULL + CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id) +) +/ + +CREATE SEQUENCE sq_phpbb_warnings_warning_id +/ + +CREATE OR REPLACE TRIGGER ai_phpbb_warnings_warning_id +BEFORE INSERT ON phpbb_warnings +FOR EACH ROW WHEN ( + new.warning_id IS NULL OR new.warning_id = 0 +) +BEGIN + SELECT sq_phpbb_warnings_warning_id.nextval + INTO :new.warning_id + FROM dual; +END; +/ + /* Table: phpbb_words */ diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 0737c60ede..c3bca14354 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -2,7 +2,6 @@ PostgreSQL Schema for phpBB 3.x - (c) phpBB Group, 2005 $Id$ -@todo user_last_warning to users table and warnings table */ BEGIN; @@ -1170,6 +1169,7 @@ CREATE TABLE phpbb_users ( user_lastpage varchar(100) DEFAULT '' NOT NULL, user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, user_warnings INT2 DEFAULT '0' NOT NULL, + user_last_warning INT4 DEFAULT '0' NOT NULL, user_login_attempts INT4 DEFAULT '0' NOT NULL, user_posts INT4 DEFAULT '0' NOT NULL, user_lang varchar(30) DEFAULT '' NOT NULL, @@ -1235,6 +1235,18 @@ CREATE INDEX username_phpbb_users_index ON phpbb_users (username); SELECT SETVAL('phpbb_users_user_id_seq',(select case when max(user_id)>0 then max(user_id)+1 else 1 end from phpbb_users)); +/* Table: phpbb_warnings */ +CREATE SEQUENCE phpbb_warnings_warning_id_seq; + +CREATE TABLE phpbb_warnings ( + warning_id INT4 DEFAULT nextval('phpbb_warnings_warning_id_seq'), + user_id INT4 DEFAULT '0' NOT NULL, + post_id INT4 DEFAULT '0' NOT NULL, + log_id INT4 DEFAULT '0' NOT NULL, + warning_time INT4 DEFAULT '0' NOT NULL, + PRIMARY KEY (warning_id) +); + /* Table: phpbb_words */ CREATE SEQUENCE phpbb_words_word_id_seq; diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 66dc04924c..9679f061ef 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -2,7 +2,6 @@ # SQLite Schema for phpBB 3.x - (c) phpBB Group, 2005 # # $Id$ -# @todo user_last_warning to users table and warnings table # BEGIN TRANSACTION; @@ -889,6 +888,7 @@ CREATE TABLE phpbb_users ( user_lastpage varchar(100) NOT NULL DEFAULT '', user_last_confirm_key varchar(10) NOT NULL DEFAULT '', user_warnings tinyint(4) NOT NULL DEFAULT '0', + user_last_warning int(11) NOT NULL DEFAULT '0', user_login_attempts smallint(4) NOT NULL DEFAULT '0', user_posts mediumint(8) NOT NULL DEFAULT '0', user_lang varchar(30) NOT NULL DEFAULT '', @@ -943,6 +943,15 @@ CREATE INDEX user_birthday_phpbb_users on phpbb_users (user_birthday); CREATE INDEX user_email_hash_phpbb_users on phpbb_users (user_email_hash); CREATE INDEX username_phpbb_users on phpbb_users (username); +# Table: phpbb_warnings +CREATE TABLE phpbb_warnings ( + warning_id INTEGER PRIMARY KEY NOT NULL, + user_id mediumint(8) NOT NULL DEFAULT '0', + post_id mediumint(8) NOT NULL DEFAULT '0', + log_id mediumint(8) NOT NULL DEFAULT '0', + warning_time int(11) NOT NULL DEFAULT '0' +); + # Table: phpbb_words CREATE TABLE phpbb_words ( word_id INTEGER PRIMARY KEY NOT NULL,