Compatible with tag PRIMARY_KEY

This commit is contained in:
Jinzhu 2020-04-12 13:16:15 +08:00
parent a46d48ccb3
commit e1bcca6b33
1 changed files with 2 additions and 0 deletions

View File

@ -148,6 +148,8 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field {
if val, ok := field.TagSettings["PRIMARYKEY"]; ok && checkTruth(val) {
field.PrimaryKey = true
} else if val, ok := field.TagSettings["PRIMARY_KEY"]; ok && checkTruth(val) {
field.PrimaryKey = true
}
if val, ok := field.TagSettings["AUTOINCREMENT"]; ok && checkTruth(val) {