In my case saved data can be cleaned without fear in case of model changes, there is a better way to do this ?
private val dataSource = try {
MyObjectBox.builder().androidContext(context).build().boxFor(XXXX::class)
} catch (e: Exception) {
BoxStore.deleteAllFiles(context, BoxStoreBuilder.DEFAULT_NAME)
MyObjectBox.builder().androidContext(context).build().boxFor(XXXX::class)
}
I'm wondering if there is such a thing as this: https://developer.android.com/reference/android/arch/persistence/room/RoomDatabase.Builder#fallbackToDestructiveMigration()