-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CreateBulk fails when entity has only ID field #3944
Comments
This can be simply reproduced by:
and,
Sorry for my confusion. |
t-coron
changed the title
M2M CreateBulk fails when entity has only ID field
CreateBulk fails when entity has only ID field
Feb 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for an awesome library!
I want to create entities with M2M relationship by CreateBulk().
The problem is that CreateBulk() throws an error if entity has only ID field.
failed creating group: add m2m edge for table group_users: Error 1048 (23000): Column 'group_id' cannot be null
Current Behavior 😯
We cannot create M2M entities through CreateBulk if entity has only ID field.
(Or, is this the expected behavior?)
Expected Behavior 🤔
CreateBulk succeeds even if entity has only ID fied.
Steps to Reproduce 🕹
We first define two simple entities with M2M relationship like below.
This is my create function with CreateBulk().
Then, we got the following error.
It seems to me that ent generates the wrong query to insert group records.
I think the expected query is this (because we want to insert 3 records). :
The current workaround is to use three Create().Save(ctx) funcs instead of CreateBulk().
Your Environment 🌎
The text was updated successfully, but these errors were encountered: