Skip to content

Commit

Permalink
fix(library): restored inLibrary songs with liked closes #65
Browse files Browse the repository at this point in the history
  • Loading branch information
Malopieds committed Jun 22, 2024
1 parent f6caed6 commit 5185a86
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/src/main/java/com/zionhuang/music/db/MusicDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MusicDatabase(
SortedSongAlbumMap::class,
PlaylistSongMapPreview::class
],
version = 12,
version = 13,
exportSchema = true,
autoMigrations = [
AutoMigration(from = 2, to = 3),
Expand All @@ -71,7 +71,8 @@ class MusicDatabase(
AutoMigration(from = 8, to = 9),
AutoMigration(from = 9, to = 10, spec = Migration9To10::class),
AutoMigration(from = 10, to = 11, spec = Migration10To11::class),
AutoMigration(from = 11, to = 12, spec = Migration11To12::class)
AutoMigration(from = 11, to = 12, spec = Migration11To12::class),
AutoMigration(from = 12, to = 13, spec = Migration12To13::class)
]
)
@TypeConverters(Converters::class)
Expand Down Expand Up @@ -343,3 +344,11 @@ class Migration11To12 : AutoMigrationSpec {
db.query("CREATE INDEX IF NOT EXISTS `index_song_albumId` ON `song` (`albumId`)")
}
}
@DeleteColumn.Entries(
DeleteColumn(tableName = "song", columnName = "inLibrary")
)
class Migration12To13 : AutoMigrationSpec {
override fun onPostMigrate(db: SupportSQLiteDatabase) {
db.execSQL("UPDATE song SET liked = 1 WHERE inLibrary IS NOT NULL")
}
}

0 comments on commit 5185a86

Please sign in to comment.