set up foreign keys at event repetitions and repetition exceptions
This commit is contained in:
parent
c76d1db104
commit
b00d7366d9
|
@ -1,11 +1,9 @@
|
||||||
package com.simplemobiletools.calendar.pro.models
|
package com.simplemobiletools.calendar.pro.models
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.*
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.Index
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
@Entity(tableName = "event_repetitions", indices = [(Index(value = ["id"], unique = true))])
|
@Entity(tableName = "event_repetitions", indices = [(Index(value = ["id"], unique = true))],
|
||||||
|
foreignKeys = [ForeignKey(entity = Event::class, onDelete = ForeignKey.CASCADE, parentColumns = ["id"], childColumns = ["event_id"])])
|
||||||
data class EventRepetition(
|
data class EventRepetition(
|
||||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||||
@ColumnInfo(name = "event_id") val eventId: Long,
|
@ColumnInfo(name = "event_id") val eventId: Long,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package com.simplemobiletools.calendar.pro.models
|
package com.simplemobiletools.calendar.pro.models
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.*
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.Index
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
@Entity(tableName = "event_repetition_exceptions", indices = [(Index(value = ["id"], unique = true))])
|
@Entity(tableName = "event_repetition_exceptions", indices = [(Index(value = ["id"], unique = true))],
|
||||||
|
foreignKeys = [ForeignKey(entity = Event::class, onDelete = ForeignKey.CASCADE, parentColumns = ["id"], childColumns = ["event_id"])])
|
||||||
data class EventRepetitionException(
|
data class EventRepetitionException(
|
||||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||||
@ColumnInfo(name = "occurrence_daycode") val daycode: String,
|
@ColumnInfo(name = "occurrence_daycode") val daycode: String,
|
||||||
|
|
Loading…
Reference in New Issue