From a640647edd0776555b9d2083fd968b2317143c8c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 19 Jul 2009 05:28:30 -0400
Subject: [PATCH] - handle big attachments with file pointers to not exceed memory_limit in rcmail_save_attachment()

---
 SQL/postgres.initial.sql |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index e53caa1..1a21ee2 100644
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -1,3 +1,5 @@
+-- RoundCube Webmail initial database structure
+
 --
 -- Sequence "user_ids"
 -- Name: user_ids; Type: SEQUENCE; Schema: public; Owner: postgres
@@ -21,7 +23,7 @@
     alias character varying(128) DEFAULT ''::character varying NOT NULL,
     created timestamp with time zone DEFAULT now() NOT NULL,
     last_login timestamp with time zone DEFAULT now() NOT NULL,
-    "language" character varying(5) DEFAULT 'en'::character varying NOT NULL,
+    "language" character varying(5),
     preferences text DEFAULT ''::text NOT NULL
 );
 
@@ -42,6 +44,7 @@
     vars text NOT NULL
 );
 
+CREATE INDEX session_changed_idx ON session (changed);
 
 
 --
@@ -64,8 +67,8 @@
 CREATE TABLE identities (
     identity_id integer DEFAULT nextval('identity_ids'::text) PRIMARY KEY,
     user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
-    del integer DEFAULT 0 NOT NULL,
-    standard integer DEFAULT 0 NOT NULL,
+    del smallint DEFAULT 0 NOT NULL,
+    standard smallint DEFAULT 0 NOT NULL,
     name character varying(128) NOT NULL,
     organization character varying(128),
     email character varying(128) NOT NULL,
@@ -99,7 +102,7 @@
     contact_id integer DEFAULT nextval('contact_ids'::text) PRIMARY KEY,
     user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
     changed timestamp with time zone DEFAULT now() NOT NULL,
-    del integer DEFAULT 0 NOT NULL,
+    del smallint DEFAULT 0 NOT NULL,
     name character varying(128) DEFAULT ''::character varying NOT NULL,
     email character varying(128) DEFAULT ''::character varying NOT NULL,
     firstname character varying(128) DEFAULT ''::character varying NOT NULL,
@@ -128,14 +131,13 @@
 CREATE TABLE "cache" (
     cache_id integer DEFAULT nextval('cache_ids'::text) PRIMARY KEY,
     user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
-    session_id character varying(40) REFERENCES "session" (sess_id) ON DELETE CASCADE ON UPDATE CASCADE,
     cache_key character varying(128) DEFAULT ''::character varying NOT NULL,
     created timestamp with time zone DEFAULT now() NOT NULL,
     data text NOT NULL
 );
 
 CREATE INDEX cache_user_id_idx ON "cache" (user_id, cache_key);
-CREATE INDEX cache_session_id_idx ON "cache" (session_id);
+CREATE INDEX cache_created_idx ON "cache" (created);
 
 --
 -- Sequence "message_ids"
@@ -156,7 +158,7 @@
 CREATE TABLE messages (
     message_id integer DEFAULT nextval('message_ids'::text) PRIMARY KEY,
     user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
-    del integer DEFAULT 0 NOT NULL,
+    del smallint DEFAULT 0 NOT NULL,
     cache_key character varying(128) DEFAULT ''::character varying NOT NULL,
     created timestamp with time zone DEFAULT now() NOT NULL,
     idx integer DEFAULT 0 NOT NULL,

--
Gitblit v1.9.1