mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Fix a problem with database migration on nightly builds (#3335)
This commit is contained in:
parent
796bb80868
commit
dca4a31fc6
2 changed files with 13 additions and 2 deletions
|
@ -8,7 +8,7 @@ Improvements 🙌:
|
||||||
-
|
-
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
-
|
- Fix a problem with database migration on nightly builds (#3335)
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -44,7 +44,7 @@ import javax.inject.Inject
|
||||||
class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
|
class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SESSION_STORE_SCHEMA_VERSION = 12L
|
const val SESSION_STORE_SCHEMA_VERSION = 13L
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||||
|
@ -62,6 +62,7 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
|
||||||
if (oldVersion <= 9) migrateTo10(realm)
|
if (oldVersion <= 9) migrateTo10(realm)
|
||||||
if (oldVersion <= 10) migrateTo11(realm)
|
if (oldVersion <= 10) migrateTo11(realm)
|
||||||
if (oldVersion <= 11) migrateTo12(realm)
|
if (oldVersion <= 11) migrateTo12(realm)
|
||||||
|
if (oldVersion <= 12) migrateTo13(realm)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateTo1(realm: DynamicRealm) {
|
private fun migrateTo1(realm: DynamicRealm) {
|
||||||
|
@ -274,4 +275,14 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
|
||||||
?.addField(SpaceChildSummaryEntityFields.SUGGESTED, Boolean::class.java)
|
?.addField(SpaceChildSummaryEntityFields.SUGGESTED, Boolean::class.java)
|
||||||
?.setNullable(SpaceChildSummaryEntityFields.SUGGESTED, true)
|
?.setNullable(SpaceChildSummaryEntityFields.SUGGESTED, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun migrateTo13(realm: DynamicRealm) {
|
||||||
|
Timber.d("Step 12 -> 13")
|
||||||
|
|
||||||
|
// Fix issue with the nightly build. Eventually play again the migration which has been included in migrateTo12()
|
||||||
|
realm.schema.get("SpaceChildSummaryEntity")
|
||||||
|
?.takeIf { !it.hasField(SpaceChildSummaryEntityFields.SUGGESTED) }
|
||||||
|
?.addField(SpaceChildSummaryEntityFields.SUGGESTED, Boolean::class.java)
|
||||||
|
?.setNullable(SpaceChildSummaryEntityFields.SUGGESTED, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue