From 9a2de8411ecb66e3df2fae5e65f0251b7c25173f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 21 May 2012 11:53:58 -0400
Subject: [PATCH] Merge branch 'courier-fix'

---
 SQL/postgres.update.sql |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index 4bd0400..7e9d34f 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -101,7 +101,7 @@
 TRUNCATE messages;
 TRUNCATE cache;
 
--- Updates from version 0.6-stable
+-- Updates from version 0.6
 
 CREATE TABLE dictionary (
     user_id integer DEFAULT NULL
@@ -127,7 +127,7 @@
     CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)
 );
 
-DROP SEQUENCE messages_ids;
+DROP SEQUENCE message_ids;
 DROP TABLE messages;
 
 CREATE TABLE cache_index (
@@ -135,6 +135,7 @@
     	REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
     mailbox varchar(255) NOT NULL,
     changed timestamp with time zone DEFAULT now() NOT NULL,
+    valid smallint NOT NULL DEFAULT 0,
     data text NOT NULL,
     PRIMARY KEY (user_id, mailbox)
 );
@@ -159,13 +160,18 @@
     uid integer NOT NULL,
     changed timestamp with time zone DEFAULT now() NOT NULL,
     data text NOT NULL,
-    seen smallint NOT NULL DEFAULT 0,
-    deleted smallint NOT NULL DEFAULT 0,
-    answered smallint NOT NULL DEFAULT 0,
-    forwarded smallint NOT NULL DEFAULT 0,
-    flagged smallint NOT NULL DEFAULT 0,
-    mdnsent smallint NOT NULL DEFAULT 0,
+    flags integer NOT NULL DEFAULT 0,
     PRIMARY KEY (user_id, mailbox, uid)
 );
 
 CREATE INDEX cache_messages_changed_idx ON cache_messages (changed);
+
+-- Updates from version 0.7-beta
+
+ALTER TABLE "session" ALTER sess_id TYPE varchar(128);
+
+-- Updates from version 0.7
+
+DROP INDEX contacts_user_id_idx;
+CREATE INDEX contacts_user_id_idx ON contacts USING btree (user_id, del);
+ALTER TABLE contacts ALTER email TYPE text;

--
Gitblit v1.9.1