Don't set auto increment primary key's HasDefaultValue to true

This commit is contained in:
Jinzhu 2016-08-13 21:46:49 +08:00
parent 294eb58fc2
commit 8f0f5df8c6
1 changed files with 1 additions and 1 deletions

View File

@ -175,7 +175,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
field.HasDefaultValue = true
}
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok {
if _, ok := field.TagSettings["AUTO_INCREMENT"]; ok && !field.IsPrimaryKey {
field.HasDefaultValue = true
}