How to use additional columns by Parent-Child reference?
- Dominant language
- Kotlin
- Stars
- 9.3k
- Forks
- 798
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 26
Description
I have following two tables. I would like to specify an additional amount per entry for the join table PartToPart. My intention is to create a graph of the different combinations.
_object Parts : IntIdTable() {
val partnumber = varchar("partnumber", 120).uniqueIndex()
val description = varchar("description", 255)
val internalDescription = varchar("internalDescription", 255).nullable()
val userId = reference("user", Users)
val parameter = text("parameter").nullable()
val partGroup = reference("partGroup", PartGroups)
}
object PartToParts : IntIdTable() {
val parent = reference("parent", Parts)
val child = reference("child", Parts)
**val quantity = integer("quantity")**
}_
Here you can see my pitiful attempt. What is the right course of action?
_class Part(id: EntityID) : IntEntity(id) {
companion object : IntEntityClass(Parts)
var partnumber by Parts.partnumber
var parents by Part.via(PartToParts.child, PartToParts.parent)
var children by Part.via(PartToParts.parent, PartToParts.child)
**var quantity by PartToParts.quantity**
var description by Parts.description
var internalDescription by Parts.internalDescription
var userId by User referencedOn Parts.userId
var parameter by Parts.parameter
var partGroup by PartGroup referencedOn Parts.partGroup
}_
Thank you in advance for your suggestions ;)
Contributor guide
Assessment
This issue has not been assessed yet.