Merge branch 'otiai10-feature/id-but-not-autoincremental'

This commit is contained in:
Jinzhu 2015-11-22 09:35:43 +08:00
commit c0b9e3af82
1 changed files with 4 additions and 1 deletions

View File

@ -435,10 +435,13 @@ func (scope *Scope) generateSqlTag(field *StructField) string {
size, _ = strconv.Atoi(value)
}
_, autoIncrease := sqlSettings["AUTO_INCREMENT"]
v, autoIncrease := sqlSettings["AUTO_INCREMENT"]
if field.IsPrimaryKey {
autoIncrease = true
}
if v == "FALSE" {
autoIncrease = false
}
sqlType = scope.Dialect().SqlTag(reflectValue, size, autoIncrease)
}