Fix possible performance issues with reactions query.

This commit is contained in:
Greyson Parrelli
2019-12-05 19:10:37 -05:00
parent e94d4b64cf
commit 19c83de510
5 changed files with 13 additions and 5 deletions

View File

@@ -97,8 +97,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int USERNAMES = 36;
private static final int REACTIONS = 37;
private static final int STORAGE_SERVICE = 38;
private static final int REACTIONS_UNREAD_INDEX = 39;
private static final int DATABASE_VERSION = 38;
private static final int DATABASE_VERSION = 39;
private static final String DATABASE_NAME = "signal.db";
private final Context context;
@@ -673,6 +674,11 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
// }
}
if (oldVersion < REACTIONS_UNREAD_INDEX) {
db.execSQL("CREATE INDEX IF NOT EXISTS sms_reactions_unread_index ON sms (reactions_unread);");
db.execSQL("CREATE INDEX IF NOT EXISTS mms_reactions_unread_index ON mms (reactions_unread);");
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();