mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10247] Remove unecessary attempt_id primary key column
The database update drops any key of the same name (potential primary key) and afterwards the column. This does not work on some of the supported DBMS and needs further changes. PHPBB3-10247
This commit is contained in:
parent
ffa6f3448f
commit
cf4b639be5
9 changed files with 13 additions and 54 deletions
|
@ -1223,7 +1223,6 @@ function get_schema_struct()
|
||||||
|
|
||||||
$schema_data['phpbb_login_attempts'] = array(
|
$schema_data['phpbb_login_attempts'] = array(
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'attempt_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'attempt_ip' => array('VCHAR:40', ''),
|
'attempt_ip' => array('VCHAR:40', ''),
|
||||||
'attempt_browser' => array('VCHAR:150', ''),
|
'attempt_browser' => array('VCHAR:150', ''),
|
||||||
'attempt_forwarded_for' => array('VCHAR:255', ''),
|
'attempt_forwarded_for' => array('VCHAR:255', ''),
|
||||||
|
@ -1232,7 +1231,6 @@ function get_schema_struct()
|
||||||
'username' => array('VCHAR_UNI:255', 0),
|
'username' => array('VCHAR_UNI:255', 0),
|
||||||
'username_clean' => array('VCHAR_CI', 0),
|
'username_clean' => array('VCHAR_CI', 0),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'attempt_id',
|
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
|
'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
|
||||||
'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
|
'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('UPDATES_TO_VERSION', '3.0.9-RC3');
|
define('UPDATES_TO_VERSION', '3.0.9-RC4');
|
||||||
|
|
||||||
// Enter any version to update from to test updates. The version within the db will not be updated.
|
// Enter any version to update from to test updates. The version within the db will not be updated.
|
||||||
define('DEBUG_FROM_VERSION', false);
|
define('DEBUG_FROM_VERSION', false);
|
||||||
|
@ -974,6 +974,16 @@ function database_update_info()
|
||||||
'3.0.9-RC1' => array(),
|
'3.0.9-RC1' => array(),
|
||||||
// No changes from 3.0.9-RC2 to 3.0.9-RC3
|
// No changes from 3.0.9-RC2 to 3.0.9-RC3
|
||||||
'3.0.9-RC2' => array(),
|
'3.0.9-RC2' => array(),
|
||||||
|
|
||||||
|
// Changes from 3.0.9-RC-3 to 3.0.9-RC4
|
||||||
|
'3.0.9-RC3' => array(
|
||||||
|
'drop_keys' => array(
|
||||||
|
LOGIN_ATTEMPT_TABLE => array('attempt_id')
|
||||||
|
),
|
||||||
|
'drop_columns' => array(
|
||||||
|
LOGIN_ATTEMPT_TABLE => array('attempt_id')
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,6 @@ END;;
|
||||||
|
|
||||||
# Table: 'phpbb_login_attempts'
|
# Table: 'phpbb_login_attempts'
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id INTEGER NOT NULL,
|
|
||||||
attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
|
@ -557,24 +556,11 @@ CREATE TABLE phpbb_login_attempts (
|
||||||
username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE
|
username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE
|
||||||
);;
|
);;
|
||||||
|
|
||||||
ALTER TABLE phpbb_login_attempts ADD PRIMARY KEY (attempt_id);;
|
|
||||||
|
|
||||||
CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);;
|
CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);;
|
||||||
CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);;
|
CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);;
|
||||||
CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);;
|
CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);;
|
||||||
CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);;
|
CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);;
|
||||||
|
|
||||||
CREATE GENERATOR phpbb_login_attempts_gen;;
|
|
||||||
SET GENERATOR phpbb_login_attempts_gen TO 0;;
|
|
||||||
|
|
||||||
CREATE TRIGGER t_phpbb_login_attempts FOR phpbb_login_attempts
|
|
||||||
BEFORE INSERT
|
|
||||||
AS
|
|
||||||
BEGIN
|
|
||||||
NEW.attempt_id = GEN_ID(phpbb_login_attempts_gen, 1);
|
|
||||||
END;;
|
|
||||||
|
|
||||||
|
|
||||||
# Table: 'phpbb_moderator_cache'
|
# Table: 'phpbb_moderator_cache'
|
||||||
CREATE TABLE phpbb_moderator_cache (
|
CREATE TABLE phpbb_moderator_cache (
|
||||||
forum_id INTEGER DEFAULT 0 NOT NULL,
|
forum_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
|
|
@ -653,7 +653,6 @@ GO
|
||||||
Table: 'phpbb_login_attempts'
|
Table: 'phpbb_login_attempts'
|
||||||
*/
|
*/
|
||||||
CREATE TABLE [phpbb_login_attempts] (
|
CREATE TABLE [phpbb_login_attempts] (
|
||||||
[attempt_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
||||||
[attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL ,
|
[attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL ,
|
||||||
[attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL ,
|
[attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL ,
|
||||||
[attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||||
|
@ -664,13 +663,6 @@ CREATE TABLE [phpbb_login_attempts] (
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER TABLE [phpbb_login_attempts] WITH NOCHECK ADD
|
|
||||||
CONSTRAINT [PK_phpbb_login_attempts] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[attempt_id]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY]
|
CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,6 @@ CREATE TABLE phpbb_log (
|
||||||
|
|
||||||
# Table: 'phpbb_login_attempts'
|
# Table: 'phpbb_login_attempts'
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
|
||||||
attempt_ip varbinary(40) DEFAULT '' NOT NULL,
|
attempt_ip varbinary(40) DEFAULT '' NOT NULL,
|
||||||
attempt_browser varbinary(150) DEFAULT '' NOT NULL,
|
attempt_browser varbinary(150) DEFAULT '' NOT NULL,
|
||||||
attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL,
|
attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL,
|
||||||
|
@ -379,7 +378,6 @@ CREATE TABLE phpbb_login_attempts (
|
||||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
username blob NOT NULL,
|
username blob NOT NULL,
|
||||||
username_clean blob NOT NULL,
|
username_clean blob NOT NULL,
|
||||||
PRIMARY KEY (attempt_id),
|
|
||||||
KEY att_ip (attempt_ip, attempt_time),
|
KEY att_ip (attempt_ip, attempt_time),
|
||||||
KEY att_for (attempt_forwarded_for, attempt_time),
|
KEY att_for (attempt_forwarded_for, attempt_time),
|
||||||
KEY att_time (attempt_time),
|
KEY att_time (attempt_time),
|
||||||
|
|
|
@ -371,7 +371,6 @@ CREATE TABLE phpbb_log (
|
||||||
|
|
||||||
# Table: 'phpbb_login_attempts'
|
# Table: 'phpbb_login_attempts'
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
|
||||||
attempt_ip varchar(40) DEFAULT '' NOT NULL,
|
attempt_ip varchar(40) DEFAULT '' NOT NULL,
|
||||||
attempt_browser varchar(150) DEFAULT '' NOT NULL,
|
attempt_browser varchar(150) DEFAULT '' NOT NULL,
|
||||||
attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
|
attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
|
||||||
|
@ -379,7 +378,6 @@ CREATE TABLE phpbb_login_attempts (
|
||||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
username varchar(255) DEFAULT '0' NOT NULL,
|
username varchar(255) DEFAULT '0' NOT NULL,
|
||||||
username_clean varchar(255) DEFAULT '0' NOT NULL,
|
username_clean varchar(255) DEFAULT '0' NOT NULL,
|
||||||
PRIMARY KEY (attempt_id),
|
|
||||||
KEY att_ip (attempt_ip, attempt_time),
|
KEY att_ip (attempt_ip, attempt_time),
|
||||||
KEY att_for (attempt_forwarded_for, attempt_time),
|
KEY att_for (attempt_forwarded_for, attempt_time),
|
||||||
KEY att_time (attempt_time),
|
KEY att_time (attempt_time),
|
||||||
|
|
|
@ -744,15 +744,13 @@ END;
|
||||||
Table: 'phpbb_login_attempts'
|
Table: 'phpbb_login_attempts'
|
||||||
*/
|
*/
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id number(8) NOT NULL,
|
|
||||||
attempt_ip varchar2(40) DEFAULT '' ,
|
attempt_ip varchar2(40) DEFAULT '' ,
|
||||||
attempt_browser varchar2(150) DEFAULT '' ,
|
attempt_browser varchar2(150) DEFAULT '' ,
|
||||||
attempt_forwarded_for varchar2(255) DEFAULT '' ,
|
attempt_forwarded_for varchar2(255) DEFAULT '' ,
|
||||||
attempt_time number(11) DEFAULT '0' NOT NULL,
|
attempt_time number(11) DEFAULT '0' NOT NULL,
|
||||||
user_id number(8) DEFAULT '0' NOT NULL,
|
user_id number(8) DEFAULT '0' NOT NULL,
|
||||||
username varchar2(765) DEFAULT '0' NOT NULL,
|
username varchar2(765) DEFAULT '0' NOT NULL,
|
||||||
username_clean varchar2(255) DEFAULT '0' NOT NULL,
|
username_clean varchar2(255) DEFAULT '0' NOT NULL
|
||||||
CONSTRAINT pk_phpbb_login_attempts PRIMARY KEY (attempt_id)
|
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
|
|
||||||
|
@ -765,22 +763,6 @@ CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time
|
||||||
CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id)
|
CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id)
|
||||||
/
|
/
|
||||||
|
|
||||||
CREATE SEQUENCE phpbb_login_attempts_seq
|
|
||||||
/
|
|
||||||
|
|
||||||
CREATE OR REPLACE TRIGGER t_phpbb_login_attempts
|
|
||||||
BEFORE INSERT ON phpbb_login_attempts
|
|
||||||
FOR EACH ROW WHEN (
|
|
||||||
new.attempt_id IS NULL OR new.attempt_id = 0
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
SELECT phpbb_login_attempts_seq.nextval
|
|
||||||
INTO :new.attempt_id
|
|
||||||
FROM dual;
|
|
||||||
END;
|
|
||||||
/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Table: 'phpbb_moderator_cache'
|
Table: 'phpbb_moderator_cache'
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -527,18 +527,14 @@ CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id);
|
||||||
/*
|
/*
|
||||||
Table: 'phpbb_login_attempts'
|
Table: 'phpbb_login_attempts'
|
||||||
*/
|
*/
|
||||||
CREATE SEQUENCE phpbb_login_attempts_seq;
|
|
||||||
|
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id INT4 DEFAULT nextval('phpbb_login_attempts_seq'),
|
|
||||||
attempt_ip varchar(40) DEFAULT '' NOT NULL,
|
attempt_ip varchar(40) DEFAULT '' NOT NULL,
|
||||||
attempt_browser varchar(150) DEFAULT '' NOT NULL,
|
attempt_browser varchar(150) DEFAULT '' NOT NULL,
|
||||||
attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
|
attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL,
|
||||||
attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
|
attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0),
|
||||||
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
||||||
username varchar(255) DEFAULT '0' NOT NULL,
|
username varchar(255) DEFAULT '0' NOT NULL,
|
||||||
username_clean varchar_ci DEFAULT '0' NOT NULL,
|
username_clean varchar_ci DEFAULT '0' NOT NULL
|
||||||
PRIMARY KEY (attempt_id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
|
CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time);
|
||||||
|
|
|
@ -359,7 +359,6 @@ CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id);
|
||||||
|
|
||||||
# Table: 'phpbb_login_attempts'
|
# Table: 'phpbb_login_attempts'
|
||||||
CREATE TABLE phpbb_login_attempts (
|
CREATE TABLE phpbb_login_attempts (
|
||||||
attempt_id INTEGER PRIMARY KEY NOT NULL ,
|
|
||||||
attempt_ip varchar(40) NOT NULL DEFAULT '',
|
attempt_ip varchar(40) NOT NULL DEFAULT '',
|
||||||
attempt_browser varchar(150) NOT NULL DEFAULT '',
|
attempt_browser varchar(150) NOT NULL DEFAULT '',
|
||||||
attempt_forwarded_for varchar(255) NOT NULL DEFAULT '',
|
attempt_forwarded_for varchar(255) NOT NULL DEFAULT '',
|
||||||
|
|
Loading…
Add table
Reference in a new issue