From 9c064b95cc78917185ddc17858808c3d33366614 Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Thu, 17 Oct 2024 13:03:35 +0200 Subject: [PATCH] feat: Delete Realm when migration is needed --- .../multiplatform_swisstransfer/database/RealmProvider.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt index 18ef60e2..71f0dff4 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/RealmProvider.kt @@ -59,18 +59,21 @@ class RealmProvider(private val loadDataInMemory: Boolean = false) { private val realmAppSettingsConfiguration = RealmConfiguration .Builder(schema = setOf(AppSettingsDB::class)) .name("AppSettings") + .deleteRealmIfMigrationNeeded() // TODO: Remove before going to production ! .loadDataInMemoryIfNeeded() .build() private val realmUploadDBConfiguration = RealmConfiguration .Builder(schema = setOf(UploadDB::class, UploadContainerDB::class, UploadFileDB::class)) .name("Uploads") + .deleteRealmIfMigrationNeeded() // TODO: Remove before going to production ! .loadDataInMemoryIfNeeded() .build() private fun realmTransfersConfiguration(userId: Int) = RealmConfiguration .Builder(schema = setOf(TransferDB::class, ContainerDB::class, FileDB::class)) .name(transferRealmName(userId)) + .deleteRealmIfMigrationNeeded() // TODO: Remove before going to production ! .loadDataInMemoryIfNeeded() .build()