mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
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:
committed by
Nicholas Tinsley
parent
d6d9e5ca64
commit
c4ba579310
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user