diff options
Diffstat (limited to 'install')
-rw-r--r-- | install/schema_mysql.sql | 2 | ||||
-rw-r--r-- | install/schema_postgres.sql | 2 | ||||
-rw-r--r-- | install/update.php | 12 |
3 files changed, 15 insertions, 1 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 8addc0af9..247b33814 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -688,6 +688,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `item_restrict` int(11) NOT NULL DEFAULT '0', `item_flags` int(11) NOT NULL DEFAULT '0', `item_private` tinyint(4) NOT NULL DEFAULT '0', + `item_unseen` smallint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `parent` (`parent`), @@ -717,6 +718,7 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `public_policy` (`public_policy`), KEY `comments_closed` (`comments_closed`), KEY `changed` (`changed`), + KEY `item_unseen` (`item_unseen`), FULLTEXT KEY `title` (`title`), FULLTEXT KEY `body` (`body`), FULLTEXT KEY `allow_cid` (`allow_cid`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index b68a7cb97..d852f38e9 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -528,6 +528,7 @@ CREATE TABLE "item" ( "item_restrict" bigint NOT NULL DEFAULT '0', "item_flags" bigint NOT NULL DEFAULT '0', "item_private" numeric(4) NOT NULL DEFAULT '0', + "item_unseen" smallint(1) NOT NULL DEFAULT '0', "item_search_vector" tsvector, PRIMARY KEY ("id") ); @@ -559,6 +560,7 @@ create index "item_uid_mid" on item ("mid","uid"); create index "item_public_policy" on item ("public_policy"); create index "item_comment_policy" on item ("comment_policy"); create index "item_layout_mid" on item ("layout_mid"); +create index "item_unseen" on item ("item_unseen"); -- fulltext indexes create index "item_search_idx" on item USING gist("item_search_vector"); diff --git a/install/update.php b/install/update.php index 2c9e54ff9..d2f1ead3c 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1136 ); +define( 'UPDATE_VERSION' , 1137 ); /** * @@ -1558,3 +1558,13 @@ function update_r1135() { return UPDATE_SUCCESS; return UPDATE_FAILED; } + +function update_r1136() { + $r1 = q("alter table item add item_unseen smallint(1) not null default '0' "); + $r2 = q("create index item_unseen on item ( item_unseen ) "); + $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 "); + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} |