lets fall back to db recreation on some error, it is better than a crashing app

This commit is contained in:
tibbi 2018-12-17 14:07:41 +01:00
parent f54ef4a2a6
commit 96d839cd8c

View file

@ -30,6 +30,7 @@ abstract class GalleryDatabase : RoomDatabase() {
synchronized(GalleryDatabase::class) { synchronized(GalleryDatabase::class) {
if (db == null) { if (db == null) {
db = Room.databaseBuilder(context.applicationContext, GalleryDatabase::class.java, "gallery.db") db = Room.databaseBuilder(context.applicationContext, GalleryDatabase::class.java, "gallery.db")
.fallbackToDestructiveMigration()
.addMigrations(MIGRATION_4_5) .addMigrations(MIGRATION_4_5)
.addMigrations(MIGRATION_5_6) .addMigrations(MIGRATION_5_6)
.build() .build()