Skip to content

Commit

Permalink
fix eager creation for associations by adding where clause (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
xixinjie committed Sep 24, 2022
1 parent 0ec97c7 commit 36e6fe0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion executors.go
Expand Up @@ -273,7 +273,8 @@ func (c *Connection) Create(model interface{}, excludeColumns ...string) error {
if IsZeroOfUnderlyingType(id) {
return c.Create(m.Value)
}
exists, errE := Q(c).Exists(i)

exists, errE := Q(c).Where("id = ?", id).Exists(i)
if errE != nil || !exists {
return c.Create(m.Value)
}
Expand Down

0 comments on commit 36e6fe0

Please sign in to comment.