diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetition.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetition.kt index 86db25efb..0e94ba01d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetition.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetition.kt @@ -1,11 +1,9 @@ package com.simplemobiletools.calendar.pro.models -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.Index -import androidx.room.PrimaryKey +import androidx.room.* -@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( @PrimaryKey(autoGenerate = true) var id: Long?, @ColumnInfo(name = "event_id") val eventId: Long, diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetitionException.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetitionException.kt index f6d993fdf..f27ce38fc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetitionException.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/EventRepetitionException.kt @@ -1,11 +1,9 @@ package com.simplemobiletools.calendar.pro.models -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.Index -import androidx.room.PrimaryKey +import androidx.room.* -@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( @PrimaryKey(autoGenerate = true) var id: Long?, @ColumnInfo(name = "occurrence_daycode") val daycode: String,