set up foreign keys at event repetitions and repetition exceptions

This commit is contained in:
tibbi 2018-11-16 11:45:33 +01:00
parent c76d1db104
commit b00d7366d9
2 changed files with 6 additions and 10 deletions

View File

@ -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,

View File

@ -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,