From ce610a9560f3b8651c50f6355b0b8b6c9ad8d3bc Mon Sep 17 00:00:00 2001 From: Lisa Casner Date: Tue, 12 Jan 2021 21:05:05 -0800 Subject: [PATCH] title case schema name (#3940) --- schema/relationship.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/relationship.go b/schema/relationship.go index ae0e0b2b..b2253035 100644 --- a/schema/relationship.go +++ b/schema/relationship.go @@ -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:"-"`, })