Я хотел бы установить связь между двумя таблицами, и у меня возникла проблема при этом.
Моя первая сущность:
@Entity(tableName = "rooms_table")
data class RoomsEntity(
@PrimaryKey
val room_id: Int,
val room_name: String,
val last_message: String,
val room_image: String,
val last_date: Date?,
val new_counter: Int
) {
constructor() : this(0, "","", "", null,0)
}
Вторая сущность:
@Entity(
tableName = "subscribers_table",
foreignKeys = [ForeignKey(
entity = RoomsEntity::class,
parentColumns = arrayOf("subscriber_id"),
childColumns = arrayOf ("room_id"),
onDelete = ForeignKey.CASCADE
) ]
)
data class SubscribersEntity(
@PrimaryKey
val subscriber_id: Int,
val room_id: Int,
val subscriber_name: String,
val subscriber_image: String
) {
constructor() : this(0, 0, "", "")
}
У меня есть эта ошибка при создании моего проекта:
"room_id column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised to create an index that covers this column."
взгляните на этот stackoverflow.com/questions/44480761/…