title case schema name

This commit is contained in:
lisamryl 2021-01-12 12:48:24 -08:00
parent de850edb4f
commit 763ae647b3

View File

@ -219,7 +219,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel
}
for idx, ownField := range ownForeignFields {
joinFieldName := schema.Name + ownField.Name
joinFieldName := strings.Title(schema.Name) + ownField.Name
if len(joinForeignKeys) > idx {
joinFieldName = strings.Title(joinForeignKeys[idx])
}
@ -258,7 +258,7 @@ func (schema *Schema) buildMany2ManyRelation(relation *Relationship, field *Fiel
}
joinTableFields = append(joinTableFields, reflect.StructField{
Name: schema.Name + field.Name,
Name: strings.Title(schema.Name) + field.Name,
Type: schema.ModelType,
Tag: `gorm:"-"`,
})