Hi :wave: . I was wondering if anyone could help w...
# exposed
j
Hi 👋 . I was wondering if anyone could help with structuring a simple one-to-many.
Copy code
object Articles : IntIdTable() {
    val title = text("title")
    val intro = text("intro")
    val image = text("image")
    val date = text("date")
    val author = text("author")
    val url = text("url").index()
}

object Blocks : IntIdTable() {
    val articleId = reference("article_id", Articles.id, ReferenceOption.CASCADE)
    val type = enumeration("type", ContentType::class)
    val content = text("content")
}

class Article(id: EntityID<Int>) : IntEntity(id) {
    var title by Articles.title
    --->var blocks by Block referrersOn Blocks.articleId<---
    companion object : IntEntityClass<Article>(Articles)
}

class Block(id: EntityID<Int>) : IntEntity(id) {
    val articleId by Article referencedOn Articles.id
    val type by Blocks.type
    val content by Blocks.content
    companion object : IntEntityClass<Block>(Blocks)
}
In the Article class, I am trying to reference a list of blocks