From 6203e214d228c041c1af796e08eed98c7d96f3ef Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sat, 13 Feb 2021 16:01:47 +0100 Subject: [PATCH] db migration quick fix: rather lose data than crash-loop --- .../info/nightscout/androidaps/database/AppDatabase.kt | 9 ++++----- .../nightscout/androidaps/database/DatabaseModule.kt | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt index 5a943b6310..f2cf4c1f7e 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt @@ -6,14 +6,13 @@ import androidx.room.TypeConverters import info.nightscout.androidaps.database.daos.* import info.nightscout.androidaps.database.entities.* -const val DATABASE_VERSION = 2 +const val DATABASE_VERSION = 3 @Database(version = DATABASE_VERSION, - entities = arrayOf(APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class, + entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class, EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class, - TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, - APSResultLink::class, MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class, - VersionChange::class, UserEntry::class), + TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, APSResultLink::class, + MealLink::class, MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class], exportSchema = true) @TypeConverters(Converters::class) internal abstract class AppDatabase : RoomDatabase() { diff --git a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt index 9ef0b9e0ab..b36e16ff5d 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt @@ -22,6 +22,7 @@ open class DatabaseModule { Room .databaseBuilder(context, AppDatabase::class.java, fileName) .addMigrations(migration1to2) + .fallbackToDestructiveMigration() .build() @Qualifier