Merge pull request #2005 from philipwhiuk/clearFullTextSearch
Delete data from Full-Text-Search table
This commit is contained in:
commit
217c61430d
4 changed files with 20 additions and 1 deletions
|
@ -322,6 +322,8 @@ public class LocalMessage extends MimeMessage {
|
|||
throw new WrappedException(e);
|
||||
}
|
||||
|
||||
deleteFulltextIndexEntry(db, mId);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
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)");
|
||||
}
|
||||
}
|
|
@ -64,6 +64,8 @@ public class Migrations {
|
|||
MigrationTo54.addPreviewTypeColumn(db);
|
||||
case 54:
|
||||
MigrationTo55.createFtsSearchTable(db, migrationsHelper);
|
||||
case 55:
|
||||
MigrationTo56.cleanUpFtsTable(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue