Skip to content

Commit

Permalink
fix(ast): undo primary key changes (#1139)
Browse files Browse the repository at this point in the history
They were fixed by other changes.

Reverts #1135 / e97ad54
  • Loading branch information
steebchen committed Dec 30, 2023
1 parent d2b2373 commit a10327f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions generator/ast/transform/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion generator/ast/transform/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down

0 comments on commit a10327f

Please sign in to comment.