Mitigate app migration failing on missing table.

In an ideal world, we'd fix this with a database migration... but we're
seeing _really_ weird behavior around FTS tables, and I'd rather not
press my luck.
This commit is contained in:
Greyson Parrelli
2024-08-27 11:48:06 -04:00
committed by Nicholas Tinsley
parent d6d9e5ca64
commit c4ba579310

View File

@@ -146,6 +146,12 @@ class SearchTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
fun rebuildIndex(batchSize: Long = 10_000L) {
val maxId: Long = SignalDatabase.messages.getNextId()
if (!SqlUtil.tableExists(readableDatabase, FTS_TABLE_NAME)) {
Log.w(TAG, "FTS table does not exist. Rebuilding.")
fullyResetTables()
return
}
Log.i(TAG, "Re-indexing. Operating on ID's 1-$maxId in steps of $batchSize.")
for (i in 1..maxId step batchSize) {