Merge pull request #3305 from vector-im/feature/bma/realm_update

Upgrade Realm to version 10.4.0
This commit is contained in:
Benoit Marty 2021-05-10 16:34:39 +02:00 committed by GitHub
commit dd0e5e2bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -34,6 +34,7 @@ SDK API changes ⚠️:
Build 🧱: Build 🧱:
- Upgrade to gradle 7 - Upgrade to gradle 7
- https://github.com/Piasy/BigImageViewer is now hosted on mavenCentral() - https://github.com/Piasy/BigImageViewer is now hosted on mavenCentral()
- Upgrade Realm to version 10.4.0
Test: Test:
- -

View File

@ -6,13 +6,10 @@ apply plugin: 'realm-android'
buildscript { buildscript {
repositories { repositories {
// mavenCentral() mavenCentral()
//noinspection GrDeprecatedAPIUsage
jcenter()
} }
dependencies { dependencies {
// Stick to this version until https://github.com/realm/realm-java/issues/7402 is fixed classpath "io.realm:realm-gradle-plugin:10.4.0"
classpath "io.realm:realm-gradle-plugin:10.3.1"
} }
} }

View File

@ -144,10 +144,6 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
Timber.d("Step 7 -> 8") Timber.d("Step 7 -> 8")
val editionOfEventSchema = realm.schema.create("EditionOfEvent") val editionOfEventSchema = realm.schema.create("EditionOfEvent")
.apply {
// setEmbedded does not return `this`...
isEmbedded = true
}
.addField(EditionOfEventFields.CONTENT, String::class.java) .addField(EditionOfEventFields.CONTENT, String::class.java)
.addField(EditionOfEventFields.EVENT_ID, String::class.java) .addField(EditionOfEventFields.EVENT_ID, String::class.java)
.setRequired(EditionOfEventFields.EVENT_ID, true) .setRequired(EditionOfEventFields.EVENT_ID, true)
@ -162,6 +158,10 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
?.removeField("lastEditTs") ?.removeField("lastEditTs")
?.removeField("sourceLocalEchoEvents") ?.removeField("sourceLocalEchoEvents")
?.addRealmListField(EditAggregatedSummaryEntityFields.EDITIONS.`$`, editionOfEventSchema) ?.addRealmListField(EditAggregatedSummaryEntityFields.EDITIONS.`$`, editionOfEventSchema)
// This has to be done once a parent use the model as a child
// See https://github.com/realm/realm-java/issues/7402
editionOfEventSchema.isEmbedded = true
} }
private fun migrateTo9(realm: DynamicRealm) { private fun migrateTo9(realm: DynamicRealm) {