add index to message.conversationUuid

This commit is contained in:
Daniel Gultsch 2017-02-07 21:17:08 +01:00
parent 24fab162e2
commit d9e2ab62b2

View File

@ -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) {