Don't prepend override field name.

This commit is contained in:
Jason Chavannes 2018-01-16 09:11:11 -08:00
parent f0ab6ac92a
commit 26342ec75c

View File

@ -300,13 +300,13 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, field.DBName) relationship.AssociationForeignFieldNames = append(relationship.AssociationForeignFieldNames, field.DBName)
// If a new name was provided for the field, use it // If a new name was provided for the field, use it
name = field.DBName name = ToDBName(elemType.Name()) + "_" + field.DBName
if len(parts) > 1 { if len(parts) > 1 {
name = parts[1] name = parts[1]
} }
// join table foreign keys for association // join table foreign keys for association
joinTableDBName := ToDBName(elemType.Name()) + "_" + name joinTableDBName := name
relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, joinTableDBName) relationship.AssociationForeignDBNames = append(relationship.AssociationForeignDBNames, joinTableDBName)
} }
} }