Resolve realm migration conflicts

This commit is contained in:
ariskotsomitopoulos 2022-02-22 13:57:43 +02:00
parent deb86d2e87
commit 9953d0d0ed
3 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ internal class ThreadSummaryMapper @Inject constructor() {
roomId = threadSummary.room?.firstOrNull()?.roomId.orEmpty(), roomId = threadSummary.room?.firstOrNull()?.roomId.orEmpty(),
rootEvent = threadSummary.rootThreadEventEntity?.asDomain(), rootEvent = threadSummary.rootThreadEventEntity?.asDomain(),
latestEvent = threadSummary.latestThreadEventEntity?.asDomain(), latestEvent = threadSummary.latestThreadEventEntity?.asDomain(),
rootEventId = threadSummary.rootThreadEventId, rootEventId = threadSummary.rootThreadEventId.orEmpty(),
rootThreadSenderInfo = SenderInfo( rootThreadSenderInfo = SenderInfo(
userId = threadSummary.rootThreadEventEntity?.sender ?: "", userId = threadSummary.rootThreadEventEntity?.sender ?: "",
displayName = threadSummary.rootThreadSenderName, displayName = threadSummary.rootThreadSenderName,

View File

@ -45,10 +45,10 @@ class MigrateSessionTo026(realm: DynamicRealm) : RealmMigrator(realm, 26) {
.addField(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, String::class.java, FieldAttribute.INDEXED) .addField(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, String::class.java, FieldAttribute.INDEXED)
.addField(ThreadSummaryEntityFields.ROOT_THREAD_SENDER_NAME, String::class.java) .addField(ThreadSummaryEntityFields.ROOT_THREAD_SENDER_NAME, String::class.java)
.addField(ThreadSummaryEntityFields.ROOT_THREAD_SENDER_AVATAR, String::class.java) .addField(ThreadSummaryEntityFields.ROOT_THREAD_SENDER_AVATAR, String::class.java)
.addField(ThreadSummaryEntityFields.ROOT_THREAD_IS_UNIQUE_DISPLAY_NAME, String::class.java) .addField(ThreadSummaryEntityFields.ROOT_THREAD_IS_UNIQUE_DISPLAY_NAME, Boolean::class.java)
.addField(ThreadSummaryEntityFields.LATEST_THREAD_SENDER_NAME, String::class.java) .addField(ThreadSummaryEntityFields.LATEST_THREAD_SENDER_NAME, String::class.java)
.addField(ThreadSummaryEntityFields.LATEST_THREAD_SENDER_AVATAR, String::class.java) .addField(ThreadSummaryEntityFields.LATEST_THREAD_SENDER_AVATAR, String::class.java)
.addField(ThreadSummaryEntityFields.LATEST_THREAD_IS_UNIQUE_DISPLAY_NAME, String::class.java) .addField(ThreadSummaryEntityFields.LATEST_THREAD_IS_UNIQUE_DISPLAY_NAME, Boolean::class.java)
.addField(ThreadSummaryEntityFields.NUMBER_OF_THREADS, Int::class.java) .addField(ThreadSummaryEntityFields.NUMBER_OF_THREADS, Int::class.java)
.addField(ThreadSummaryEntityFields.IS_USER_PARTICIPATING, Boolean::class.java) .addField(ThreadSummaryEntityFields.IS_USER_PARTICIPATING, Boolean::class.java)
.addRealmObjectField(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ENTITY.`$`, eventEntity) .addRealmObjectField(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ENTITY.`$`, eventEntity)
@ -58,6 +58,6 @@ class MigrateSessionTo026(realm: DynamicRealm) : RealmMigrator(realm, 26) {
?.addRealmListField(RoomEntityFields.THREAD_SUMMARIES.`$`, threadSummaryEntity) ?.addRealmListField(RoomEntityFields.THREAD_SUMMARIES.`$`, threadSummaryEntity)
realm.schema.get("HomeServerCapabilitiesEntity") realm.schema.get("HomeServerCapabilitiesEntity")
?.addRealmListField(HomeServerCapabilitiesEntityFields.CAN_USE_THREADING, Boolean::class.java) ?.addField(HomeServerCapabilitiesEntityFields.CAN_USE_THREADING, Boolean::class.java)
} }
} }

View File

@ -23,7 +23,7 @@ import io.realm.annotations.LinkingObjects
import org.matrix.android.sdk.internal.database.model.EventEntity import org.matrix.android.sdk.internal.database.model.EventEntity
import org.matrix.android.sdk.internal.database.model.RoomEntity import org.matrix.android.sdk.internal.database.model.RoomEntity
internal open class ThreadSummaryEntity(@Index var rootThreadEventId: String = "", internal open class ThreadSummaryEntity(@Index var rootThreadEventId: String? = "",
var rootThreadEventEntity: EventEntity? = null, var rootThreadEventEntity: EventEntity? = null,
var latestThreadEventEntity: EventEntity? = null, var latestThreadEventEntity: EventEntity? = null,
var rootThreadSenderName: String? = null, var rootThreadSenderName: String? = null,