entc/gen: edge schema with custom ids (#2742)

Fixed https://github.com/ent/ent/issues/2740
Fixed https://github.com/ent/ent/issues/2741
This commit is contained in:
Ariel Mashraki
2022-07-12 18:13:45 +03:00
committed by GitHub
parent b00e549c88
commit 6c8a1308ec
38 changed files with 4162 additions and 164 deletions

View File

@@ -335,7 +335,7 @@ func (u *{{ $upsertBulk }}) UpdateNewValues() *{{ $upsertBulk }} {
{{- if or $udfID $.ImmutableFields }}
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
for _, b := range u.create.builders {
{{- if $.ID.UserDefined }}
{{- if $udfID }}
if _, exists := b.mutation.ID(); exists {
s.SetIgnore({{ $.Package }}.{{ $.ID.Constant }})
return