Sync subId when syncing message

This commit is contained in:
Moez Bhatti
2018-05-30 12:17:16 -04:00
parent c0968e4b42
commit f71d2564b2
9 changed files with 21 additions and 6 deletions
@@ -24,6 +24,10 @@ import io.realm.RealmMigration
class QkRealmMigration : RealmMigration {
companion object {
const val SCHEMA_VERSION: Long = 2
}
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
var version = oldVersion
@@ -34,6 +38,13 @@ class QkRealmMigration : RealmMigration {
version++
}
if (version == 1L) {
realm.schema.get("Message")
?.addField("subId", Int::class.java)
version++
}
if (version < newVersion) {
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
}