Cherry pick mentions badge database migration.

This commit is contained in:
Cody Henthorne 2022-10-18 13:53:33 -04:00
parent f0e94ebbad
commit 0d715d2c18
2 changed files with 16 additions and 1 deletions

View file

@ -13,13 +13,14 @@ import org.thoughtcrime.securesms.database.helpers.migration.V155_SmsExporterMig
import org.thoughtcrime.securesms.database.helpers.migration.V156_RecipientUnregisteredTimestampMigration
import org.thoughtcrime.securesms.database.helpers.migration.V157_RecipeintHiddenMigration
import org.thoughtcrime.securesms.database.helpers.migration.V158_GroupsLastForceUpdateTimestampMigration
import org.thoughtcrime.securesms.database.helpers.migration.V159_ThreadUnreadSelfMentionCount
/**
* Contains all of the database migrations for [SignalDatabase]. Broken into a separate file for cleanliness.
*/
object SignalDatabaseMigrations {
const val DATABASE_VERSION = 158
const val DATABASE_VERSION = 159
@JvmStatic
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
@ -62,6 +63,10 @@ object SignalDatabaseMigrations {
if (oldVersion < 158) {
V158_GroupsLastForceUpdateTimestampMigration.migrate(context, db, oldVersion, newVersion)
}
if (oldVersion < 159) {
V159_ThreadUnreadSelfMentionCount.migrate(context, db, oldVersion, newVersion)
}
}
@JvmStatic

View file

@ -0,0 +1,10 @@
package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
object V159_ThreadUnreadSelfMentionCount : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE thread ADD COLUMN unread_self_mention_count INTEGER DEFAULT 0")
}
}