Ensure that the V262 database migration runs.

This commit is contained in:
Greyson Parrelli 2024-12-20 21:34:59 -05:00
parent 31897b4c4b
commit 7320a66273
3 changed files with 9 additions and 6 deletions

View file

@ -146,7 +146,8 @@ class InAppPaymentSubscriberTable(
* Retrieves a subscriber for the given type by the currency code.
*/
fun getByCurrencyCode(currencyCode: String): InAppPaymentSubscriberRecord? {
return readableDatabase.select()
return readableDatabase
.select()
.from(TABLE_NAME)
.where("$CURRENCY_CODE = ?", currencyCode.uppercase())
.run()
@ -157,7 +158,8 @@ class InAppPaymentSubscriberTable(
* Retrieves a subscriber by SubscriberId
*/
fun getBySubscriberId(subscriberId: SubscriberId): InAppPaymentSubscriberRecord? {
return readableDatabase.select()
return readableDatabase
.select()
.from(TABLE_NAME)
.where("$SUBSCRIBER_ID = ?", subscriberId.serialize())
.run()

View file

@ -118,7 +118,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V258_FixGroupRevoke
import org.thoughtcrime.securesms.database.helpers.migration.V259_AdjustNotificationProfileMidnightEndTimes
import org.thoughtcrime.securesms.database.helpers.migration.V260_RemapQuoteAuthors
import org.thoughtcrime.securesms.database.helpers.migration.V261_RemapCallRingers
import org.thoughtcrime.securesms.database.helpers.migration.V262_InAppPaymentsSubscriberTableRebuild
import org.thoughtcrime.securesms.database.helpers.migration.V263_InAppPaymentsSubscriberTableRebuild
/**
* Contains all of the database migrations for [SignalDatabase]. Broken into a separate file for cleanliness.
@ -240,10 +240,11 @@ object SignalDatabaseMigrations {
259 to V259_AdjustNotificationProfileMidnightEndTimes,
260 to V260_RemapQuoteAuthors,
261 to V261_RemapCallRingers,
261 to V262_InAppPaymentsSubscriberTableRebuild
// V263 was originally V262, but a typo in the version mapping caused it not to be run.
263 to V263_InAppPaymentsSubscriberTableRebuild
)
const val DATABASE_VERSION = 262
const val DATABASE_VERSION = 263
@JvmStatic
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {

View file

@ -12,7 +12,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* Adds IAP fields and updates constraints.
*/
@Suppress("ClassName")
object V262_InAppPaymentsSubscriberTableRebuild : SignalDatabaseMigration {
object V263_InAppPaymentsSubscriberTableRebuild : SignalDatabaseMigration {
private const val DONOR_TYPE = 0
private const val BACKUP_TYPE = 1