Clean up FTS table on update

This commit is contained in:
cketti 2017-01-08 08:50:10 +01:00
parent 071f88e96e
commit f3e5534797
3 changed files with 14 additions and 1 deletions

View file

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

View file

@ -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)");
}
}

View file

@ -64,6 +64,8 @@ public class Migrations {
MigrationTo54.addPreviewTypeColumn(db);
case 54:
MigrationTo55.createFtsSearchTable(db, migrationsHelper);
case 55:
MigrationTo56.cleanUpFtsTable(db);
}
}
}