[feature/soft-delete] Add new fields for topic/post counts for softdelete

We can not use the replies vs replies_real anymore, as we need to be able to
determinate whether the posts are unapproved or softdeleted. So we need to add
a new field and there by change the second one for consistency.
We also add the posts_* fields for forums, which are a missing feature.

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-21 22:33:28 +02:00
parent e7a137820b
commit 9c5482317e
8 changed files with 58 additions and 26 deletions

View file

@ -1097,8 +1097,11 @@ function get_schema_struct()
'forum_type' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0),
'forum_status' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0),
'forum_posts' => array('UINT', 0), 'forum_posts' => array('UINT', 0),
'forum_posts_unapproved' => array('UINT', 0),
'forum_posts_softdeleted' => array('UINT', 0),
'forum_topics' => array('UINT', 0), 'forum_topics' => array('UINT', 0),
'forum_topics_real' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0),
'forum_topics_softdeleted' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0),
'forum_last_poster_id' => array('UINT', 0), 'forum_last_poster_id' => array('UINT', 0),
'forum_last_post_subject' => array('STEXT_UNI', ''), 'forum_last_post_subject' => array('STEXT_UNI', ''),
@ -1683,8 +1686,9 @@ function get_schema_struct()
'topic_time' => array('TIMESTAMP', 0), 'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0),
'topic_views' => array('UINT', 0), 'topic_views' => array('UINT', 0),
'topic_replies' => array('UINT', 0), 'topic_posts' => array('UINT', 0),
'topic_replies_real' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0),
'topic_posts_softdeleted' => array('UINT', 0),
'topic_status' => array('TINT:3', 0), 'topic_status' => array('TINT:3', 0),
'topic_type' => array('TINT:3', 0), 'topic_type' => array('TINT:3', 0),
'topic_first_post_id' => array('UINT', 0), 'topic_first_post_id' => array('UINT', 0),

View file

@ -364,8 +364,11 @@ CREATE TABLE phpbb_forums (
forum_type INTEGER DEFAULT 0 NOT NULL, forum_type INTEGER DEFAULT 0 NOT NULL,
forum_status INTEGER DEFAULT 0 NOT NULL, forum_status INTEGER DEFAULT 0 NOT NULL,
forum_posts INTEGER DEFAULT 0 NOT NULL, forum_posts INTEGER DEFAULT 0 NOT NULL,
forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
forum_topics INTEGER DEFAULT 0 NOT NULL, forum_topics INTEGER DEFAULT 0 NOT NULL,
forum_topics_real INTEGER DEFAULT 0 NOT NULL, forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL,
forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL,
forum_last_post_id INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL,
forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, forum_last_poster_id INTEGER DEFAULT 0 NOT NULL,
forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
@ -1125,8 +1128,9 @@ CREATE TABLE phpbb_topics (
topic_time INTEGER DEFAULT 0 NOT NULL, topic_time INTEGER DEFAULT 0 NOT NULL,
topic_time_limit INTEGER DEFAULT 0 NOT NULL, topic_time_limit INTEGER DEFAULT 0 NOT NULL,
topic_views INTEGER DEFAULT 0 NOT NULL, topic_views INTEGER DEFAULT 0 NOT NULL,
topic_replies INTEGER DEFAULT 0 NOT NULL, topic_posts INTEGER DEFAULT 0 NOT NULL,
topic_replies_real INTEGER DEFAULT 0 NOT NULL, topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
topic_status INTEGER DEFAULT 0 NOT NULL, topic_status INTEGER DEFAULT 0 NOT NULL,
topic_type INTEGER DEFAULT 0 NOT NULL, topic_type INTEGER DEFAULT 0 NOT NULL,
topic_first_post_id INTEGER DEFAULT 0 NOT NULL, topic_first_post_id INTEGER DEFAULT 0 NOT NULL,

View file

@ -443,8 +443,11 @@ CREATE TABLE [phpbb_forums] (
[forum_type] [int] DEFAULT (0) NOT NULL , [forum_type] [int] DEFAULT (0) NOT NULL ,
[forum_status] [int] DEFAULT (0) NOT NULL , [forum_status] [int] DEFAULT (0) NOT NULL ,
[forum_posts] [int] DEFAULT (0) NOT NULL , [forum_posts] [int] DEFAULT (0) NOT NULL ,
[forum_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
[forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
[forum_topics] [int] DEFAULT (0) NOT NULL , [forum_topics] [int] DEFAULT (0) NOT NULL ,
[forum_topics_real] [int] DEFAULT (0) NOT NULL , [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL ,
[forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL ,
[forum_last_post_id] [int] DEFAULT (0) NOT NULL , [forum_last_post_id] [int] DEFAULT (0) NOT NULL ,
[forum_last_poster_id] [int] DEFAULT (0) NOT NULL , [forum_last_poster_id] [int] DEFAULT (0) NOT NULL ,
[forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL ,
@ -1360,8 +1363,9 @@ CREATE TABLE [phpbb_topics] (
[topic_time] [int] DEFAULT (0) NOT NULL , [topic_time] [int] DEFAULT (0) NOT NULL ,
[topic_time_limit] [int] DEFAULT (0) NOT NULL , [topic_time_limit] [int] DEFAULT (0) NOT NULL ,
[topic_views] [int] DEFAULT (0) NOT NULL , [topic_views] [int] DEFAULT (0) NOT NULL ,
[topic_replies] [int] DEFAULT (0) NOT NULL , [topic_posts] [int] DEFAULT (0) NOT NULL ,
[topic_replies_real] [int] DEFAULT (0) NOT NULL , [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
[topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
[topic_status] [int] DEFAULT (0) NOT NULL , [topic_status] [int] DEFAULT (0) NOT NULL ,
[topic_type] [int] DEFAULT (0) NOT NULL , [topic_type] [int] DEFAULT (0) NOT NULL ,
[topic_first_post_id] [int] DEFAULT (0) NOT NULL , [topic_first_post_id] [int] DEFAULT (0) NOT NULL ,

View file

@ -250,8 +250,11 @@ CREATE TABLE phpbb_forums (
forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_subject blob NOT NULL, forum_last_post_subject blob NOT NULL,
@ -787,8 +790,9 @@ CREATE TABLE phpbb_topics (
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL,
topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_type tinyint(3) DEFAULT '0' NOT NULL,
topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,

View file

@ -250,8 +250,11 @@ CREATE TABLE phpbb_forums (
forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
@ -787,8 +790,9 @@ CREATE TABLE phpbb_topics (
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL,
topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_type tinyint(3) DEFAULT '0' NOT NULL,
topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,

View file

@ -510,8 +510,11 @@ CREATE TABLE phpbb_forums (
forum_type number(4) DEFAULT '0' NOT NULL, forum_type number(4) DEFAULT '0' NOT NULL,
forum_status number(4) DEFAULT '0' NOT NULL, forum_status number(4) DEFAULT '0' NOT NULL,
forum_posts number(8) DEFAULT '0' NOT NULL, forum_posts number(8) DEFAULT '0' NOT NULL,
forum_posts_unapproved number(8) DEFAULT '0' NOT NULL,
forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
forum_topics number(8) DEFAULT '0' NOT NULL, forum_topics number(8) DEFAULT '0' NOT NULL,
forum_topics_real number(8) DEFAULT '0' NOT NULL, forum_topics_unapproved number(8) DEFAULT '0' NOT NULL,
forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL,
forum_last_post_id number(8) DEFAULT '0' NOT NULL, forum_last_post_id number(8) DEFAULT '0' NOT NULL,
forum_last_poster_id number(8) DEFAULT '0' NOT NULL, forum_last_poster_id number(8) DEFAULT '0' NOT NULL,
forum_last_post_subject varchar2(765) DEFAULT '' , forum_last_post_subject varchar2(765) DEFAULT '' ,
@ -1490,8 +1493,9 @@ CREATE TABLE phpbb_topics (
topic_time number(11) DEFAULT '0' NOT NULL, topic_time number(11) DEFAULT '0' NOT NULL,
topic_time_limit number(11) DEFAULT '0' NOT NULL, topic_time_limit number(11) DEFAULT '0' NOT NULL,
topic_views number(8) DEFAULT '0' NOT NULL, topic_views number(8) DEFAULT '0' NOT NULL,
topic_replies number(8) DEFAULT '0' NOT NULL, topic_posts number(8) DEFAULT '0' NOT NULL,
topic_replies_real number(8) DEFAULT '0' NOT NULL, topic_posts_unapproved number(8) DEFAULT '0' NOT NULL,
topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
topic_status number(3) DEFAULT '0' NOT NULL, topic_status number(3) DEFAULT '0' NOT NULL,
topic_type number(3) DEFAULT '0' NOT NULL, topic_type number(3) DEFAULT '0' NOT NULL,
topic_first_post_id number(8) DEFAULT '0' NOT NULL, topic_first_post_id number(8) DEFAULT '0' NOT NULL,

View file

@ -386,8 +386,11 @@ CREATE TABLE phpbb_forums (
forum_type INT2 DEFAULT '0' NOT NULL, forum_type INT2 DEFAULT '0' NOT NULL,
forum_status INT2 DEFAULT '0' NOT NULL, forum_status INT2 DEFAULT '0' NOT NULL,
forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0),
forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0),
forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0), forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0),
forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0),
forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
@ -1025,8 +1028,9 @@ CREATE TABLE phpbb_topics (
topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0), topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0),
topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0), topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0),
topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0),
topic_status INT2 DEFAULT '0' NOT NULL, topic_status INT2 DEFAULT '0' NOT NULL,
topic_type INT2 DEFAULT '0' NOT NULL, topic_type INT2 DEFAULT '0' NOT NULL,
topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),

View file

@ -243,8 +243,11 @@ CREATE TABLE phpbb_forums (
forum_type tinyint(4) NOT NULL DEFAULT '0', forum_type tinyint(4) NOT NULL DEFAULT '0',
forum_status tinyint(4) NOT NULL DEFAULT '0', forum_status tinyint(4) NOT NULL DEFAULT '0',
forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_post_subject text(65535) NOT NULL DEFAULT '', forum_last_post_subject text(65535) NOT NULL DEFAULT '',
@ -762,8 +765,9 @@ CREATE TABLE phpbb_topics (
topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_replies INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_replies_real INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_status tinyint(3) NOT NULL DEFAULT '0', topic_status tinyint(3) NOT NULL DEFAULT '0',
topic_type tinyint(3) NOT NULL DEFAULT '0', topic_type tinyint(3) NOT NULL DEFAULT '0',
topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',