title case schema name (#3940)

This commit is contained in:
Lisa Casner 2021-01-12 21:05:05 -08:00 committed by GitHub
parent de850edb4f
commit ce610a9560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

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:"-"`,
})