Clear attachment uploadTimestamps.
This commit is contained in:
parent
59e0afde14
commit
f8846e3593
2 changed files with 24 additions and 2 deletions
|
@ -105,6 +105,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V243_MessageFullTex
|
||||||
import org.thoughtcrime.securesms.database.helpers.migration.V244_AttachmentRemoteIv
|
import org.thoughtcrime.securesms.database.helpers.migration.V244_AttachmentRemoteIv
|
||||||
import org.thoughtcrime.securesms.database.helpers.migration.V245_DeletionTimestampOnCallLinks
|
import org.thoughtcrime.securesms.database.helpers.migration.V245_DeletionTimestampOnCallLinks
|
||||||
import org.thoughtcrime.securesms.database.helpers.migration.V246_DropThumbnailCdnFromAttachments
|
import org.thoughtcrime.securesms.database.helpers.migration.V246_DropThumbnailCdnFromAttachments
|
||||||
|
import org.thoughtcrime.securesms.database.helpers.migration.V247_ClearUploadTimestamp
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all of the database migrations for [SignalDatabase]. Broken into a separate file for cleanliness.
|
* Contains all of the database migrations for [SignalDatabase]. Broken into a separate file for cleanliness.
|
||||||
|
@ -211,10 +212,11 @@ object SignalDatabaseMigrations {
|
||||||
243 to V243_MessageFullTextSearchDisableSecureDelete,
|
243 to V243_MessageFullTextSearchDisableSecureDelete,
|
||||||
244 to V244_AttachmentRemoteIv,
|
244 to V244_AttachmentRemoteIv,
|
||||||
245 to V245_DeletionTimestampOnCallLinks,
|
245 to V245_DeletionTimestampOnCallLinks,
|
||||||
246 to V246_DropThumbnailCdnFromAttachments
|
246 to V246_DropThumbnailCdnFromAttachments,
|
||||||
|
247 to V247_ClearUploadTimestamp
|
||||||
)
|
)
|
||||||
|
|
||||||
const val DATABASE_VERSION = 246
|
const val DATABASE_VERSION = 247
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 Signal Messenger, LLC
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.thoughtcrime.securesms.database.helpers.migration
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import net.zetetic.database.sqlcipher.SQLiteDatabase
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There was a bad interaction with the digest backfill job, where digests could be changed, and then already-uploaded attachments could be re-used
|
||||||
|
* but with a no-longer-matching digest. This migration set the upload timestamp to 1 for all uploaded attachments so that we don't re-use them.
|
||||||
|
*/
|
||||||
|
@Suppress("ClassName")
|
||||||
|
object V247_ClearUploadTimestamp : SignalDatabaseMigration {
|
||||||
|
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
db.execSQL("UPDATE attachment SET upload_timestamp = 1 WHERE upload_timestamp > 0")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue