From d9e2ab62b2e0750bd3faa11439098ee7890c9002 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 7 Feb 2017 21:17:08 +0100 Subject: [PATCH] add index to message.conversationUuid --- .../siacs/conversations/persistance/DatabaseBackend.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index d9feabbe0..b05044a00 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -58,7 +58,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { private static DatabaseBackend instance = null; private static final String DATABASE_NAME = "history"; - private static final int DATABASE_VERSION = 34; + private static final int DATABASE_VERSION = 35; private static String CREATE_CONTATCS_STATEMENT = "create table " + Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, " @@ -150,6 +150,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { private static String CREATE_START_TIMES_TABLE = "create table "+START_TIMES_TABLE+" (timestamp NUMBER);"; private static String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON "+Message.TABLENAME+"("+Message.TIME_SENT+")"; + private static String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON "+Message.TABLENAME+"("+Message.CONVERSATION+")"; private DatabaseBackend(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); @@ -199,6 +200,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Conversation.TABLENAME + "(" + Conversation.UUID + ") ON DELETE CASCADE);"); db.execSQL(CREATE_MESSAGE_TIME_INDEX); + db.execSQL(CREATE_MESSAGE_CONVERSATION_INDEX); db.execSQL(CREATE_CONTATCS_STATEMENT); db.execSQL(CREATE_DISCOVERY_RESULTS_STATEMENT); db.execSQL(CREATE_SESSIONS_STATEMENT); @@ -436,6 +438,9 @@ public class DatabaseBackend extends SQLiteOpenHelper { } } } + if (oldVersion < 35 && newVersion >= 35) { + db.execSQL(CREATE_MESSAGE_CONVERSATION_INDEX); + } } private static ContentValues createFingerprintStatusContentValues(FingerprintStatus.Trust trust, boolean active) {