mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Sync starred contacts and groups
This commit is contained in:
@@ -26,7 +26,7 @@ import io.realm.Sort
|
||||
class QkRealmMigration : RealmMigration {
|
||||
|
||||
companion object {
|
||||
const val SCHEMA_VERSION: Long = 8
|
||||
const val SCHEMA_VERSION: Long = 9
|
||||
}
|
||||
|
||||
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||
@@ -118,6 +118,18 @@ class QkRealmMigration : RealmMigration {
|
||||
version++
|
||||
}
|
||||
|
||||
if (version == 8L) {
|
||||
realm.schema.create("ContactGroup")
|
||||
.addField("id", Long::class.java, FieldAttribute.PRIMARY_KEY, FieldAttribute.REQUIRED)
|
||||
.addField("title", String::class.java, FieldAttribute.REQUIRED)
|
||||
.addRealmListField("contacts", realm.schema.get("Contact"))
|
||||
|
||||
realm.schema.get("Contact")
|
||||
?.addField("starred", Boolean::class.java, FieldAttribute.REQUIRED)
|
||||
|
||||
version++
|
||||
}
|
||||
|
||||
check(version >= newVersion) { "Migration missing from v$oldVersion to v$newVersion" }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user