fix: revert d834dd6 for default string primary keys

This commit is contained in:
Martin Munilla 2024-04-16 18:40:02 +02:00
parent 9a61ef2af8
commit af8ad0403d

View File

@ -299,6 +299,14 @@ func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Nam
field.HasDefaultValue = true field.HasDefaultValue = true
field.AutoIncrement = true field.AutoIncrement = true
} }
case String:
if _, ok := field.TagSettings["PRIMARYKEY"]; !ok {
if !field.HasDefaultValue || field.DefaultValueInterface != nil {
schema.FieldsWithDefaultDBValue = append(schema.FieldsWithDefaultDBValue, field)
}
field.HasDefaultValue = true
}
} }
} }