mirror of
https://github.com/ent/ent.git
synced 2026-04-28 21:50:56 +03:00
dialect/sql/sqlgraph: skip setting last-insert-id if was provided (#1291)
Fixed #1290. Issue in BulkCreate(<T>) for m2m edges
This commit is contained in:
@@ -964,7 +964,10 @@ func (c *creator) batchInsert(ctx context.Context, tx dialect.ExecQuerier, inser
|
||||
return err
|
||||
}
|
||||
for i, node := range c.Nodes {
|
||||
node.ID.Value = ids[i]
|
||||
// ID field was provided by the user.
|
||||
if node.ID.Value == nil {
|
||||
node.ID.Value = ids[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user