lets fall back to db recreation on some error, it is better than a crashing app
This commit is contained in:
parent
f54ef4a2a6
commit
96d839cd8c
1 changed files with 1 additions and 0 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue