forked from upstream-mirrors/quik
#965 - Add ability to pin conversations
This commit is contained in:
@@ -26,7 +26,7 @@ import io.realm.RealmMigration
|
||||
class QkRealmMigration : RealmMigration {
|
||||
|
||||
companion object {
|
||||
const val SCHEMA_VERSION: Long = 4
|
||||
const val SCHEMA_VERSION: Long = 5
|
||||
}
|
||||
|
||||
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||
@@ -66,6 +66,13 @@ class QkRealmMigration : RealmMigration {
|
||||
version++
|
||||
}
|
||||
|
||||
if (version == 4L) {
|
||||
realm.schema.get("Conversation")
|
||||
?.addField("pinned", Boolean::class.java, FieldAttribute.REQUIRED, FieldAttribute.INDEXED)
|
||||
|
||||
version++
|
||||
}
|
||||
|
||||
if (version < newVersion) {
|
||||
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user