Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fa6d5f9 authored by Jesse Vincent's avatar Jesse Vincent
Browse files

Add an index for a heavy query

parent 31553844
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public class LocalStore extends Store implements Serializable {
     */
    private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500;

    public static final int DB_VERSION = 48;
    public static final int DB_VERSION = 49;


    public static String getColumnNameForFlag(Flag flag) {
@@ -284,6 +284,11 @@ public class LocalStore extends Store implements Serializable {
                    db.execSQL("DROP INDEX IF EXISTS msg_flagged");
                    db.execSQL("CREATE INDEX IF NOT EXISTS msg_flagged ON messages (flagged)");

                    db.execSQL("DROP INDEX IF EXISTS msg_composite");
                    db.execSQL("CREATE INDEX IF NOT EXISTS msg_composite ON messages (deleted, empty,folder_id,flagged,read)");



                    db.execSQL("DROP TABLE IF EXISTS threads");
                    db.execSQL("CREATE TABLE threads (" +
                            "id INTEGER PRIMARY KEY, " +
@@ -689,6 +694,10 @@ public class LocalStore extends Store implements Serializable {
                                "UPDATE threads SET root=id WHERE root IS NULL AND ROWID = NEW.ROWID; " +
                                "END");
                    }
                    if (db.getVersion() < 49) {
                        db.execSQL("CREATE INDEX IF NOT EXISTS msg_composite ON messages (deleted, empty,folder_id,flagged,read)");

                    }
                }

                db.setVersion(DB_VERSION);