Skip to content

Commit

Permalink
A table column with .autoIncrement() and NO .primaryKey() does create…
Browse files Browse the repository at this point in the history
… primary key with SchemaUtils.createMissingTablesAndColumns() #649
  • Loading branch information
Tapac committed Nov 1, 2019
1 parent 3367e21 commit dd2fe8d
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,8 @@ open class Table(name: String = ""): ColumnSet(), DdlAware {
}

internal fun primaryKeyConstraint(): String? {
var pkey = columns.filter { it.indexInPK != null }.sortedWith(compareBy({ !it.columnType.isAutoInc }, { it.indexInPK }))
if (pkey.isEmpty()) {
pkey = columns.filter { it.columnType.isAutoInc }
}
val pkey = columns.filter { it.indexInPK != null }.sortedWith(compareBy({ !it.columnType.isAutoInc }, { it.indexInPK }))

if (pkey.isNotEmpty()) {
val tr = TransactionManager.current()
val constraint = tr.db.identifierManager.cutIfNecessaryAndQuote("pk_$tableName")
Expand Down

0 comments on commit dd2fe8d

Please sign in to comment.