Cleanup abandoned mentions during backup restore.
parent
1d230d4cd6
commit
8d060837ad
|
@ -134,7 +134,7 @@ public class MentionDatabase extends Database {
|
|||
|
||||
void deleteAbandonedMentions() {
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
String where = MESSAGE_ID + " NOT IN (SELECT _id FROM " + MmsDatabase.TABLE_NAME + ") OR " + THREAD_ID + " NOT IN (SELECT _id FROM " + ThreadDatabase.TABLE_NAME + ")";
|
||||
String where = MESSAGE_ID + " NOT IN (SELECT " + MmsDatabase.ID + " FROM " + MmsDatabase.TABLE_NAME + ") OR " + THREAD_ID + " NOT IN (SELECT " + ThreadDatabase.ID + " FROM " + ThreadDatabase.TABLE_NAME + ")";
|
||||
|
||||
db.delete(TABLE_NAME, where, null);
|
||||
}
|
||||
|
|
|
@ -935,6 +935,8 @@ public class MmsDatabase extends MessageDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
DatabaseFactory.getMentionDatabase(context).deleteAbandonedMentions();
|
||||
|
||||
try (Cursor cursor = database.query(ThreadDatabase.TABLE_NAME, new String[] { ThreadDatabase.ID }, ThreadDatabase.EXPIRES_IN + " > 0", null, null, null, null)) {
|
||||
while (cursor != null && cursor.moveToNext()) {
|
||||
DatabaseFactory.getThreadDatabase(context).update(cursor.getLong(0), false);
|
||||
|
|
Loading…
Reference in New Issue