mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 11:08:31 +00:00
Drop UNIQUE constraint from table column.
This commit is contained in:
@@ -33,7 +33,7 @@ class LastResortKeyTupleTable(context: Context, databaseHelper: SignalDatabase)
|
||||
const val CREATE_TABLE = """
|
||||
CREATE TABLE $TABLE_NAME (
|
||||
$ID INTEGER PRIMARY KEY,
|
||||
$KYBER_PREKEY INTEGER NOT NULL UNIQUE REFERENCES ${KyberPreKeyTable.TABLE_NAME} (${KyberPreKeyTable.ID}) ON DELETE CASCADE,
|
||||
$KYBER_PREKEY INTEGER NOT NULL REFERENCES ${KyberPreKeyTable.TABLE_NAME} (${KyberPreKeyTable.ID}) ON DELETE CASCADE,
|
||||
$SIGNED_KEY_ID INTEGER NOT NULL,
|
||||
$PUBLIC_KEY BLOB NOT NULL,
|
||||
UNIQUE($KYBER_PREKEY, $SIGNED_KEY_ID, $PUBLIC_KEY)
|
||||
|
||||
@@ -148,6 +148,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V290_AddArchiveThum
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V291_NullOutRemoteKeyIfEmpty
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V292_AddPollTables
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V293_LastResortKeyTupleTableMigration
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V294_RemoveLastResortKeyTupleColumnConstraintMigration
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase as SignalSqliteDatabase
|
||||
|
||||
/**
|
||||
@@ -301,10 +302,11 @@ object SignalDatabaseMigrations {
|
||||
290 to V290_AddArchiveThumbnailTransferStateColumn,
|
||||
291 to V291_NullOutRemoteKeyIfEmpty,
|
||||
292 to V292_AddPollTables,
|
||||
293 to V293_LastResortKeyTupleTableMigration
|
||||
293 to V293_LastResortKeyTupleTableMigration,
|
||||
294 to V294_RemoveLastResortKeyTupleColumnConstraintMigration
|
||||
)
|
||||
|
||||
const val DATABASE_VERSION = 293
|
||||
const val DATABASE_VERSION = 294
|
||||
|
||||
@JvmStatic
|
||||
fun migrate(context: Application, db: SignalSqliteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2025 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.database.helpers.migration
|
||||
|
||||
import android.app.Application
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase
|
||||
|
||||
/**
|
||||
* Removes the UNIQUE constraint from kyber_prekey_id field
|
||||
*/
|
||||
@Suppress("ClassName")
|
||||
object V294_RemoveLastResortKeyTupleColumnConstraintMigration : SignalDatabaseMigration {
|
||||
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
db.execSQL("DROP TABLE last_resort_key_tuple")
|
||||
|
||||
db.execSQL(
|
||||
"""
|
||||
CREATE TABLE last_resort_key_tuple (
|
||||
_id INTEGER PRIMARY KEY,
|
||||
kyber_prekey_id INTEGER NOT NULL REFERENCES kyber_prekey (_id) ON DELETE CASCADE,
|
||||
signed_key_id INTEGER NOT NULL,
|
||||
public_key BLOB NOT NULL,
|
||||
UNIQUE(kyber_prekey_id, signed_key_id, public_key)
|
||||
)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user