refactor: database multi-period schedule storage
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package agzam.vyatsu.data.local
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(
|
||||
tableName = "days",
|
||||
foreignKeys = [
|
||||
ForeignKey(
|
||||
entity = ScheduleEntity::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["scheduleId"],
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)
|
||||
],
|
||||
indices = [
|
||||
Index("scheduleId"),
|
||||
Index("date")
|
||||
]
|
||||
)
|
||||
data class DayEntity(
|
||||
@PrimaryKey(autoGenerate = true) val id: Long = 0,
|
||||
val scheduleId: Long,
|
||||
val date: Long
|
||||
)
|
||||
Reference in New Issue
Block a user