Changes migration to be realm list field

This commit is contained in:
ericdecanini 2022-07-05 09:35:05 +01:00
parent e003bc973a
commit 98d195c010
2 changed files with 3 additions and 4 deletions

View file

@ -24,7 +24,7 @@ internal class MigrateSessionTo032(realm: DynamicRealm) : RealmMigrator(realm, 3
override fun doMigrate(realm: DynamicRealm) {
realm.schema.get("RoomSummaryEntity")
?.addField(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, String::class.java)
?.addRealmListField(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, String::class.java)
?.transform { it.setString(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, "") }
}
}

View file

@ -34,7 +34,8 @@ internal open class RoomSummaryEntity(
@PrimaryKey var roomId: String = "",
var roomType: String? = null,
var parents: RealmList<SpaceParentSummaryEntity> = RealmList(),
var children: RealmList<SpaceChildSummaryEntity> = RealmList()
var children: RealmList<SpaceChildSummaryEntity> = RealmList(),
var directParentNames: RealmList<String> = RealmList(),
) : RealmObject() {
private var displayName: String? = ""
@ -235,8 +236,6 @@ internal open class RoomSummaryEntity(
if (value != field) field = value
}
var directParentNames: RealmList<String> = RealmList()
var flattenParentIds: String? = null
set(value) {
if (value != field) field = value