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

Commit 217c6143 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #2005 from philipwhiuk/clearFullTextSearch

Delete data from Full-Text-Search table
parents bf0fe6e2 f3e55347
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -322,6 +322,8 @@ public class LocalMessage extends MimeMessage {
                        throw new WrappedException(e);
                    }

                    deleteFulltextIndexEntry(db, mId);

                    return null;
                }
            });
+5 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class LocalStore extends Store implements Serializable {
     */
    private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500;

    public static final int DB_VERSION = 55;
    public static final int DB_VERSION = 56;


    public static String getColumnNameForFlag(Flag flag) {
@@ -331,6 +331,10 @@ public class LocalStore extends Store implements Serializable {
                // Don't delete deleted messages. They are essentially placeholders for UIDs of messages that have
                // been deleted locally.
                db.delete("messages", "deleted = 0", null);

                // We don't need the search data now either
                db.delete("messages_fulltext", null, null);

                return null;
            }
        });
+11 −0
Original line number Diff line number Diff line
package com.fsck.k9.mailstore.migrations;


import android.database.sqlite.SQLiteDatabase;


class MigrationTo56 {
    static void cleanUpFtsTable(SQLiteDatabase db) {
        db.execSQL("DELETE FROM messages_fulltext WHERE docid NOT IN (SELECT id FROM messages WHERE deleted = 0)");
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public class Migrations {
                MigrationTo54.addPreviewTypeColumn(db);
            case 54:
                MigrationTo55.createFtsSearchTable(db, migrationsHelper);
            case 55:
                MigrationTo56.cleanUpFtsTable(db);
        }
    }
}