#45 - Rename group chats

This commit is contained in:
Moez Bhatti
2018-06-09 01:23:22 -04:00
parent d4093cc8ff
commit bd6c5ca5e5
13 changed files with 140 additions and 12 deletions
@@ -19,13 +19,14 @@
package migration
import io.realm.DynamicRealm
import io.realm.FieldAttribute
import io.realm.RealmMigration
class QkRealmMigration : RealmMigration {
companion object {
const val SCHEMA_VERSION: Long = 2
const val SCHEMA_VERSION: Long = 3
}
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
@@ -45,6 +46,13 @@ class QkRealmMigration : RealmMigration {
version++
}
if (version == 2L) {
realm.schema.get("Conversation")
?.addField("name", String::class.java, FieldAttribute.REQUIRED)
version++
}
if (version < newVersion) {
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
}