You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to use optReference() for a nullable foreign key on Table but I get the following error:
Type parameter bound for T in fun <T : Comparable<T?>> optReference(name: String, refColumn: Column<T>, onDelete: ReferenceOption? = ..., onUpdate: ReferenceOption? = ...): Column<T?>
is not satisfied: inferred type Int is not a subtype of Comparable<Int?>
As a workaround, I am using reference with nullable().
The text was updated successfully, but these errors were encountered:
object ModuleTable: Table(name = "module") {
val id = integer("id").autoIncrement().primaryKey()
val name = varchar(name = "name", length = 125).uniqueIndex()
val description = varchar("description", 125)
}
object RoleTable: Table(name = "role") {
val id = integer("id").autoIncrement().primaryKey()
val name = varchar("name", 125)
val moduleId = optReference(
name = "module_id",
refColumn = ModuleTable.id,
onDelete = ReferenceOption.CASCADE
)
For now as a workaround, I can use something like:
object RoleTable: Table(name = "role") {
val id = integer("id").autoIncrement().primaryKey().uniqueIndex()
val name = varchar("name", 125)
val description = varchar("description", 125)
val moduleId = reference(
name = "module_id",
refColumn = ModuleTable.id,
onDelete = ReferenceOption.CASCADE
).nullable()
I have tried to use
optReference()
for a nullable foreign key onTable
but I get the following error:As a workaround, I am using
reference
withnullable()
.The text was updated successfully, but these errors were encountered: