forked from upstream-mirrors/quik
#45 - Rename group chats
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user