summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SQL/mysql.initial.sql1
-rw-r--r--SQL/mysql.update.sql5
-rw-r--r--SQL/mysql5.initial.sql1
-rw-r--r--SQL/postgres.initial.sql5
-rw-r--r--SQL/postgres.update.sql4
-rw-r--r--SQL/sqlite.initial.sql1
-rw-r--r--SQL/sqlite.update.sql4
7 files changed, 19 insertions, 2 deletions
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql
index ec420734f..c71894257 100644
--- a/SQL/mysql.initial.sql
+++ b/SQL/mysql.initial.sql
@@ -119,6 +119,7 @@ CREATE TABLE `messages` (
`headers` text NOT NULL,
`structure` text,
PRIMARY KEY (`message_id`),
+ INDEX `created_index` (`created`),
UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`)
);
diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql
index f07672614..ae6fb7533 100644
--- a/SQL/mysql.update.sql
+++ b/SQL/mysql.update.sql
@@ -25,3 +25,8 @@ ALTER TABLE `identities`
MODIFY `organization` varchar(128) NOT NULL DEFAULT '',
MODIFY `name` varchar(128) NOT NULL,
MODIFY `email` varchar(128) NOT NULL;
+
+-- Updates from version 0.2-alpha
+
+ALTER TABLE `messages`
+ ADD INDEX `created_index` (`created`);
diff --git a/SQL/mysql5.initial.sql b/SQL/mysql5.initial.sql
index 7e3dd9a73..f9d647b80 100644
--- a/SQL/mysql5.initial.sql
+++ b/SQL/mysql5.initial.sql
@@ -54,6 +54,7 @@ CREATE TABLE `messages` (
`headers` text NOT NULL,
`structure` text,
PRIMARY KEY(`message_id`),
+ INDEX `created_index` (`created`),
UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`)
diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index 05c61924a..88f12af66 100644
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -152,7 +152,7 @@ CREATE SEQUENCE message_ids
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres
--
-CREATE TABLE "messages" (
+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,
@@ -170,4 +170,5 @@ CREATE TABLE "messages" (
structure text
);
-ALTER TABLE "messages" ADD UNIQUE (user_id, cache_key, uid);
+ALTER TABLE messages ADD UNIQUE (user_id, cache_key, uid);
+CREATE INDEX messages_created_idx ON messages (created);
diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index e0afa61ca..dfc282b4a 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -17,3 +17,7 @@ ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_fkey;
ALTER TABLE contacts ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE cache DROP CONSTRAINT cache_user_id_fkey;
ALTER TABLE cache ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- Updates from version 0.2-alpha
+
+CREATE INDEX messages_created_idx ON messages (created);
diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql
index 6adcf4dff..4b2c30faa 100644
--- a/SQL/sqlite.initial.sql
+++ b/SQL/sqlite.initial.sql
@@ -123,3 +123,4 @@ CREATE TABLE messages (
);
CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
+CREATE INDEX ix_messages_created ON messages (created);
diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql
index 047fe6731..accf64a73 100644
--- a/SQL/sqlite.update.sql
+++ b/SQL/sqlite.update.sql
@@ -25,3 +25,7 @@ CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
CREATE INDEX ix_users_username ON users(username);
CREATE INDEX ix_users_alias ON users(alias);
+
+-- Updates from version 0.2-alpha
+
+CREATE INDEX ix_messages_created ON messages (created);