mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 12:00:03 +03:00
Fix db upgrade from previous version
This commit is contained in:
parent
1d1267ea6a
commit
969f3202de
1 changed files with 20 additions and 14 deletions
|
@ -384,6 +384,7 @@ internal class RealmCryptoStoreMigration @Inject constructor(private val crossSi
|
|||
|
||||
private fun migrateTo8(realm: DynamicRealm) {
|
||||
Timber.d("Step 7 -> 8")
|
||||
try {
|
||||
realm.schema.create("MyDeviceLastSeenInfoEntity")
|
||||
.addField(MyDeviceLastSeenInfoEntityFields.DEVICE_ID, String::class.java)
|
||||
.addPrimaryKey(MyDeviceLastSeenInfoEntityFields.DEVICE_ID)
|
||||
|
@ -391,8 +392,11 @@ internal class RealmCryptoStoreMigration @Inject constructor(private val crossSi
|
|||
.addField(MyDeviceLastSeenInfoEntityFields.LAST_SEEN_IP, String::class.java)
|
||||
.addField(MyDeviceLastSeenInfoEntityFields.LAST_SEEN_TS, Long::class.java)
|
||||
.setNullable(MyDeviceLastSeenInfoEntityFields.LAST_SEEN_TS, true)
|
||||
} catch (failure: Throwable) {
|
||||
}
|
||||
|
||||
val now = System.currentTimeMillis()
|
||||
try {
|
||||
realm.schema.get("DeviceInfoEntity")
|
||||
?.addField(DeviceInfoEntityFields.FIRST_TIME_SEEN_LOCAL_TS, Long::class.java)
|
||||
?.setNullable(DeviceInfoEntityFields.FIRST_TIME_SEEN_LOCAL_TS, true)
|
||||
|
@ -401,6 +405,8 @@ internal class RealmCryptoStoreMigration @Inject constructor(private val crossSi
|
|||
deviceInfoEntity.setLong(DeviceInfoEntityFields.FIRST_TIME_SEEN_LOCAL_TS, now)
|
||||
}
|
||||
}
|
||||
} catch (failure: Throwable) {
|
||||
}
|
||||
}
|
||||
|
||||
// Fixes duplicate devices in UserEntity#devices
|
||||
|
|
Loading…
Add table
Reference in a new issue