mirror of
https://github.com/vector-im/riotX-android
synced 2025-10-05 15:52:47 +02:00
Fix test by adding some new required Realm migrations.
This commit is contained in:
@@ -38,6 +38,7 @@ import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo
|
|||||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo019
|
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo019
|
||||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo020
|
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo020
|
||||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo021
|
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo021
|
||||||
|
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo022
|
||||||
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
||||||
import org.matrix.android.sdk.internal.util.time.Clock
|
import org.matrix.android.sdk.internal.util.time.Clock
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@@ -52,7 +53,7 @@ internal class RealmCryptoStoreMigration @Inject constructor(
|
|||||||
private val clock: Clock,
|
private val clock: Clock,
|
||||||
) : MatrixRealmMigration(
|
) : MatrixRealmMigration(
|
||||||
dbName = "Crypto",
|
dbName = "Crypto",
|
||||||
schemaVersion = 21L,
|
schemaVersion = 22L,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Forces all RealmCryptoStoreMigration instances to be equal.
|
* Forces all RealmCryptoStoreMigration instances to be equal.
|
||||||
@@ -83,5 +84,6 @@ internal class RealmCryptoStoreMigration @Inject constructor(
|
|||||||
if (oldVersion < 19) MigrateCryptoTo019(realm).perform()
|
if (oldVersion < 19) MigrateCryptoTo019(realm).perform()
|
||||||
if (oldVersion < 20) MigrateCryptoTo020(realm).perform()
|
if (oldVersion < 20) MigrateCryptoTo020(realm).perform()
|
||||||
if (oldVersion < 21) MigrateCryptoTo021(realm).perform()
|
if (oldVersion < 21) MigrateCryptoTo021(realm).perform()
|
||||||
|
if (oldVersion < 22) MigrateCryptoTo022(realm).perform()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 The Matrix.org Foundation C.I.C.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.matrix.android.sdk.internal.crypto.store.db.migration
|
||||||
|
|
||||||
|
import io.realm.DynamicRealm
|
||||||
|
import org.matrix.android.sdk.internal.crypto.store.db.model.OutgoingKeyRequestEntityFields
|
||||||
|
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This migration make OutgoingKeyRequestEntity.requestStateStr required. Seems to be due to the upgrade to Kotlin 1.8.21.
|
||||||
|
*/
|
||||||
|
internal class MigrateCryptoTo022(realm: DynamicRealm) : RealmMigrator(realm, 22) {
|
||||||
|
|
||||||
|
override fun doMigrate(realm: DynamicRealm) {
|
||||||
|
realm.schema.get("OutgoingKeyRequestEntity")
|
||||||
|
?.setRequired(OutgoingKeyRequestEntityFields.REQUEST_STATE_STR, true)
|
||||||
|
}
|
||||||
|
}
|
@@ -69,6 +69,7 @@ import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo049
|
|||||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo050
|
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo050
|
||||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo051
|
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo051
|
||||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo052
|
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo052
|
||||||
|
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo053
|
||||||
import org.matrix.android.sdk.internal.util.Normalizer
|
import org.matrix.android.sdk.internal.util.Normalizer
|
||||||
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@@ -77,7 +78,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
|||||||
private val normalizer: Normalizer
|
private val normalizer: Normalizer
|
||||||
) : MatrixRealmMigration(
|
) : MatrixRealmMigration(
|
||||||
dbName = "Session",
|
dbName = "Session",
|
||||||
schemaVersion = 52L,
|
schemaVersion = 53L,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Forces all RealmSessionStoreMigration instances to be equal.
|
* Forces all RealmSessionStoreMigration instances to be equal.
|
||||||
@@ -139,5 +140,6 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
|||||||
if (oldVersion < 50) MigrateSessionTo050(realm).perform()
|
if (oldVersion < 50) MigrateSessionTo050(realm).perform()
|
||||||
if (oldVersion < 51) MigrateSessionTo051(realm).perform()
|
if (oldVersion < 51) MigrateSessionTo051(realm).perform()
|
||||||
if (oldVersion < 52) MigrateSessionTo052(realm).perform()
|
if (oldVersion < 52) MigrateSessionTo052(realm).perform()
|
||||||
|
if (oldVersion < 53) MigrateSessionTo053(realm).perform()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 The Matrix.org Foundation C.I.C.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.matrix.android.sdk.internal.database.migration
|
||||||
|
|
||||||
|
import io.realm.DynamicRealm
|
||||||
|
import org.matrix.android.sdk.internal.database.model.EventEntityFields
|
||||||
|
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This migration make EventEntity.sendStateStr required. Seems to be due to the upgrade to Kotlin 1.8.21.
|
||||||
|
*/
|
||||||
|
internal class MigrateSessionTo053(realm: DynamicRealm) : RealmMigrator(realm, 53) {
|
||||||
|
|
||||||
|
override fun doMigrate(realm: DynamicRealm) {
|
||||||
|
realm.schema.get("EventEntity")
|
||||||
|
?.setRequired(EventEntityFields.SEND_STATE_STR, true)
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user