Add foreign key constraint to Song
This commit is contained in:
@@ -150,7 +150,7 @@ interface Database {
|
||||
views = [
|
||||
SortedSongInPlaylist::class
|
||||
],
|
||||
version = 9,
|
||||
version = 10,
|
||||
exportSchema = true,
|
||||
autoMigrations = [
|
||||
AutoMigration(from = 1, to = 2),
|
||||
@@ -160,6 +160,7 @@ interface Database {
|
||||
AutoMigration(from = 5, to = 6),
|
||||
AutoMigration(from = 6, to = 7),
|
||||
AutoMigration(from = 7, to = 8, spec = DatabaseInitializer.From7To8Migration::class),
|
||||
AutoMigration(from = 9, to = 10),
|
||||
],
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
|
||||
@@ -4,14 +4,14 @@ import androidx.room.*
|
||||
|
||||
|
||||
@Entity(
|
||||
// foreignKeys = [
|
||||
// ForeignKey(
|
||||
// entity = Album::class,
|
||||
// parentColumns = ["id"],
|
||||
// childColumns = ["albumId"],
|
||||
// onDelete = ForeignKey.CASCADE
|
||||
// ),
|
||||
// ]
|
||||
foreignKeys = [
|
||||
ForeignKey(
|
||||
entity = Album::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["albumId"],
|
||||
onDelete = ForeignKey.SET_NULL
|
||||
),
|
||||
]
|
||||
)
|
||||
data class Song(
|
||||
@PrimaryKey val id: String,
|
||||
|
||||
Reference in New Issue
Block a user