Add migration to add BlockedNumber

This commit is contained in:
moezbhatti
2019-06-20 22:59:31 -04:00
parent afa6199897
commit 06d1003384
@@ -25,7 +25,7 @@ import io.realm.RealmMigration
class QkRealmMigration : RealmMigration {
companion object {
const val SCHEMA_VERSION: Long = 5
const val SCHEMA_VERSION: Long = 6
}
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
@@ -72,6 +72,14 @@ class QkRealmMigration : RealmMigration {
version++
}
if (version == 5L) {
realm.schema.create("BlockedNumber")
.addField("id", Long::class.java, FieldAttribute.PRIMARY_KEY, FieldAttribute.REQUIRED)
.addField("address", String::class.java, FieldAttribute.REQUIRED)
version++
}
if (version < newVersion) {
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
}