diff --git a/generator/ast/transform/index.go b/generator/ast/transform/index.go index f0ba4b86..e035bb93 100644 --- a/generator/ast/transform/index.go +++ b/generator/ast/transform/index.go @@ -27,7 +27,7 @@ func indexes(m dmmf.Model) []Index { if len(m.PrimaryKey.Fields) > 0 { idx = append(idx, Index{ - Name: convert(m.PrimaryKey.Fields), + Name: getName(concatFieldsToName(m.PrimaryKey.Fields), m.PrimaryKey.Fields), InternalName: concatFieldsToName(m.PrimaryKey.Fields), Fields: m.PrimaryKey.Fields, }) @@ -51,10 +51,6 @@ func getName(field string, fields []types.String) types.String { if field != "" { return types.String(field) } - return convert(fields) -} - -func convert(fields []types.String) types.String { var name string for _, f := range fields { name += f.GoCase() diff --git a/generator/ast/transform/models.go b/generator/ast/transform/models.go index 5edefc56..010a4b75 100644 --- a/generator/ast/transform/models.go +++ b/generator/ast/transform/models.go @@ -20,7 +20,7 @@ func (m Model) CompoundKeys() []Index { if m.OldModel.PrimaryKey.Name != "" { items = append(items, Index{ - Name: types.String(m.OldModel.PrimaryKey.Name.GoCase()), + Name: m.OldModel.PrimaryKey.Name, InternalName: m.OldModel.PrimaryKey.Name.String(), Fields: m.OldModel.PrimaryKey.Fields, })