diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt index 286fcb4c4..d232ba831 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt @@ -1,5 +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 com.simplemobiletools.calendar.pro.extensions.seconds import com.simplemobiletools.calendar.pro.helpers.* import com.simplemobiletools.commons.extensions.addBit @@ -7,11 +11,26 @@ import com.simplemobiletools.commons.extensions.removeBit import org.joda.time.DateTime import java.io.Serializable -data class Event(var id: Long?, var startTS: Int = 0, var endTS: Int = 0, var title: String = "", var location: String = "", var description: String = "", - var reminder1Minutes: Int = -1, var reminder2Minutes: Int = -1, var reminder3Minutes: Int = -1, var repeatInterval: Int = 0, - var importId: String = "", var flags: Int = 0, var repeatLimit: Int = 0, var repeatRule: Int = 0, - var eventType: Long = DBHelper.REGULAR_EVENT_TYPE_ID, var parentId: Long = 0, var lastUpdated: Long = 0L, - var source: String = SOURCE_SIMPLE_CALENDAR) +@Entity(tableName = "events", indices = [(Index(value = ["id"], unique = true))]) +data class Event( + @PrimaryKey(autoGenerate = true) var id: Long?, + @ColumnInfo(name = "start_ts") var startTS: Int = 0, + @ColumnInfo(name = "end_ts") var endTS: Int = 0, + @ColumnInfo(name = "title") var title: String = "", + @ColumnInfo(name = "location") var location: String = "", + @ColumnInfo(name = "description") var description: String = "", + @ColumnInfo(name = "reminder_1_minutes") var reminder1Minutes: Int = -1, + @ColumnInfo(name = "reminder_2_minutes") var reminder2Minutes: Int = -1, + @ColumnInfo(name = "reminder_3_minutes") var reminder3Minutes: Int = -1, + @ColumnInfo(name = "repeat_interval") var repeatInterval: Int = 0, + @ColumnInfo(name = "import_id") var importId: String = "", + @ColumnInfo(name = "flags") var flags: Int = 0, + @ColumnInfo(name = "repeat_limit") var repeatLimit: Int = 0, + @ColumnInfo(name = "repeat_rule") var repeatRule: Int = 0, + @ColumnInfo(name = "event_type") var eventType: Long = DBHelper.REGULAR_EVENT_TYPE_ID, + @ColumnInfo(name = "parent_id") var parentId: Long = 0, + @ColumnInfo(name = "last_updated") var lastUpdated: Long = 0L, + @ColumnInfo(name = "source") var source: String = SOURCE_SIMPLE_CALENDAR) : Serializable { companion object {