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
object Foo: IdTable<Long>(){
val bar = integer("bar").primaryKey()
overrideval id:Column<EntityID<Long>> = long("id").entityId().autoIncrement().primaryKey()
}
This table produces crash on creation org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must be defined as a key
Simple solution is to switch the order of props:
object Foo: IdTable<Long>(){
overrideval id:Column<EntityID<Long>> = long("id").entityId().autoIncrement().primaryKey()
val bar = integer("bar").primaryKey()
}
Now the table creation goes smoothly.
Although there are situations where this workaround is not applicable (e.g. defining bar in abstract class and id in its child)
The text was updated successfully, but these errors were encountered:
Looks like a bug. As a workaround you can add index explicitly to primaryKey():
object Foo: IdTable<Long>(){
val bar = integer("bar").primaryKey(2)
override val id: Column<EntityID<Long>> = long("id").entityId().autoIncrement().primaryKey(1)
}
This table produces crash on creation
org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must be defined as a key
Simple solution is to switch the order of props:
Now the table creation goes smoothly.
Although there are situations where this workaround is not applicable (e.g. defining
bar
in abstract class andid
in its child)The text was updated successfully, but these errors were encountered: