I have LoggedInUserEntity
and UserRecentSearch
where the last one has foreignKeys to LoggedInUserEntity
. When I want to delete LoggedInUserEntity
it is possible if only no UserRecentSearch
are in database.
How do i delete?
@Query("DELETE FROM loggedInUser")
How do i use relationships?
@Entity(tableName = "recentSearches",
indices = arrayOf(Index(value = "userId",name = "idr")),
foreignKeys = arrayOf(ForeignKey(
entity = LoggedInUserEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("userId"))
))
How can i delete LoggedInUserEntity
with existing UserRecentSearch
?