Ignore message_fts table if needed in v175 migration.

This commit is contained in:
Clark 2023-08-14 15:43:42 -04:00 committed by Clark Chen
parent 13d9b6cc5a
commit 7d4bcd7f15

View file

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
import org.signal.core.util.SqlUtil
/**
* Turns out renaming a table will automatically update all of your indexes, foreign keys, triggers, basically everything... except full-text search tables.
@ -15,6 +16,11 @@ object V175_FixFullTextSearchLink : SignalDatabaseMigration {
db.execSQL("DROP TRIGGER IF EXISTS mms_ad")
db.execSQL("DROP TRIGGER IF EXISTS mms_au")
// We need to check because it's possible this table got created due to us hitting corruption first
if (SqlUtil.tableExists(db, "message_fts")) {
return
}
db.execSQL("CREATE VIRTUAL TABLE message_fts USING fts5(body, thread_id UNINDEXED, content=message, content_rowid=_id)")
db.execSQL(