mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 07:23:21 +01:00
Fix message request accepted to recipient from previous backup imports.
This commit is contained in:
committed by
jeffrey-signal
parent
6d6d277277
commit
469421fcf3
@@ -166,6 +166,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V310_AddStarredColu
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V311_AddAttachmentMediaOverviewSizeIndex
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V312_RefactorNameCollisionTables
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V313_AddCollapsingUpdateColumns
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V314_FixMessageRequestAcceptedToRecipient
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase as SignalSqliteDatabase
|
||||
|
||||
/**
|
||||
@@ -339,10 +340,11 @@ object SignalDatabaseMigrations {
|
||||
310 to V310_AddStarredColumn,
|
||||
311 to V311_AddAttachmentMediaOverviewSizeIndex,
|
||||
312 to V312_RefactorNameCollisionTables,
|
||||
313 to V313_AddCollapsingUpdateColumns
|
||||
313 to V313_AddCollapsingUpdateColumns,
|
||||
314 to V314_FixMessageRequestAcceptedToRecipient
|
||||
)
|
||||
|
||||
const val DATABASE_VERSION = 313
|
||||
const val DATABASE_VERSION = 314
|
||||
|
||||
@JvmStatic
|
||||
fun migrate(context: Application, db: SignalSqliteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.thoughtcrime.securesms.database.helpers.migration
|
||||
|
||||
import android.app.Application
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase
|
||||
|
||||
@Suppress("ClassName")
|
||||
object V314_FixMessageRequestAcceptedToRecipient : SignalDatabaseMigration {
|
||||
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
db.execSQL(
|
||||
"""
|
||||
UPDATE message
|
||||
SET to_recipient_id = (SELECT thread.recipient_id FROM thread WHERE thread._id = message.thread_id)
|
||||
WHERE (type & 0xF00000000) = 0x600000000
|
||||
AND to_recipient_id = from_recipient_id
|
||||
AND thread_id IN (SELECT _id FROM thread)
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user