mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
properly update the database by adding the new sort_value column
This commit is contained in:
parent
0e01026774
commit
21cc0b97bc
1 changed files with 8 additions and 1 deletions
|
@ -9,7 +9,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
|||
import com.simplemobiletools.gallery.pro.interfaces.*
|
||||
import com.simplemobiletools.gallery.pro.models.*
|
||||
|
||||
@Database(entities = [Directory::class, Medium::class, Widget::class, DateTaken::class, Favorite::class], version = 7)
|
||||
@Database(entities = [Directory::class, Medium::class, Widget::class, DateTaken::class, Favorite::class], version = 8)
|
||||
abstract class GalleryDatabase : RoomDatabase() {
|
||||
|
||||
abstract fun DirectoryDao(): DirectoryDao
|
||||
|
@ -34,6 +34,7 @@ abstract class GalleryDatabase : RoomDatabase() {
|
|||
.addMigrations(MIGRATION_4_5)
|
||||
.addMigrations(MIGRATION_5_6)
|
||||
.addMigrations(MIGRATION_6_7)
|
||||
.addMigrations(MIGRATION_7_8)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
@ -67,5 +68,11 @@ abstract class GalleryDatabase : RoomDatabase() {
|
|||
database.execSQL("CREATE UNIQUE INDEX `index_favorites_full_path` ON `favorites` (`full_path`)")
|
||||
}
|
||||
}
|
||||
|
||||
private val MIGRATION_7_8 = object : Migration(7, 8) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE directories ADD COLUMN sort_value TEXT NOT NULL")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue