Added option to force a refresh, added fallBackToDestructiveMigration as possible migration strategy for substitution table

This commit is contained in:
Deniz Düzgören
2019-09-08 21:07:20 +02:00
parent 371221a092
commit 47a4a51b44
11 changed files with 114 additions and 48 deletions
@@ -28,10 +28,11 @@ internal abstract class SubstDatabase : RoomDatabase() {
if (instance == null) {
synchronized (SubstDatabase::class) {
instance = Room.databaseBuilder(context.applicationContext,
SubstDatabase::class.java,
"subst_database")
.addMigrations(addTeacherColumn)
.build()
SubstDatabase::class.java,
"subst_database")
.addMigrations(addTeacherColumn)
.fallbackToDestructiveMigration()
.build()
}
}
return instance
@@ -43,10 +44,10 @@ internal abstract class SubstDatabase : RoomDatabase() {
if (foodInstance == null) {
synchronized (SubstDatabase::class) {
foodInstance = Room.databaseBuilder(context.applicationContext,
SubstDatabase::class.java,
"food_database")
.fallbackToDestructiveMigration()
.build()
SubstDatabase::class.java,
"food_database")
.fallbackToDestructiveMigration()
.build()
}
}
return foodInstance