Fix songs not loading from SD card

This commit is contained in:
Hemanth S 2020-09-12 12:23:23 +05:30
parent 0ef83c7136
commit cc494edbbf
5 changed files with 11 additions and 5 deletions

View file

@ -21,4 +21,7 @@ interface PlayCountDao {
@Query("DELETE FROM SongEntity WHERE id =:songId")
fun deleteSong(songId: Int)
@Query("UPDATE PlayCountEntity SET play_count = play_count + 1 WHERE id = :id")
fun updateQuantity(id: Int)
}

View file

@ -5,7 +5,7 @@ import androidx.room.RoomDatabase
@Database(
entities = [PlaylistEntity::class, SongEntity::class, HistoryEntity::class, PlayCountEntity::class, BlackListStoreEntity::class, LyricsEntity::class],
version = 21,
version = 22,
exportSchema = false
)
abstract class RetroDatabase : RoomDatabase() {

View file

@ -3,11 +3,12 @@ package code.name.monkey.retromusic.db
import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
@Parcelize
@Entity
@Entity(indices = [Index(value = ["playlist_creator_id", "id"], unique = true)])
class SongEntity(
@ColumnInfo(name = "playlist_creator_id")
val playlistCreatorId: Int,
@ -35,6 +36,5 @@ class SongEntity(
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "song_key")
var songPrimaryKey: Long = 0
}