mirror of https://github.com/go-gorm/gorm.git
Enable to decline antuincrement on ID field
This commit is contained in:
parent
2f9abdcf02
commit
ba12202af2
|
@ -435,10 +435,13 @@ func (scope *Scope) generateSqlTag(field *StructField) string {
|
||||||
size, _ = strconv.Atoi(value)
|
size, _ = strconv.Atoi(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, autoIncrease := sqlSettings["AUTO_INCREMENT"]
|
v, autoIncrease := sqlSettings["AUTO_INCREMENT"]
|
||||||
if field.IsPrimaryKey {
|
if field.IsPrimaryKey {
|
||||||
autoIncrease = true
|
autoIncrease = true
|
||||||
}
|
}
|
||||||
|
if v == "NO" {
|
||||||
|
autoIncrease = false
|
||||||
|
}
|
||||||
|
|
||||||
sqlType = scope.Dialect().SqlTag(reflectValue, size, autoIncrease)
|
sqlType = scope.Dialect().SqlTag(reflectValue, size, autoIncrease)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue