Don't set primary key's HasDefaultValue to true

This commit is contained in:
Hylke Visser 2018-10-10 14:46:13 +02:00
parent 742154be9a
commit 85ba776e65
No known key found for this signature in database
GPG Key ID: 435117A237F8346B

View File

@ -189,7 +189,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field) modelStruct.PrimaryFields = append(modelStruct.PrimaryFields, field)
} }
if _, ok := field.TagSettingsGet("DEFAULT"); ok { if _, ok := field.TagSettingsGet("DEFAULT"); ok && !field.IsPrimaryKey {
field.HasDefaultValue = true field.HasDefaultValue = true
} }