-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Cascade doesn't work with nullable relationship #7091
Comments
I might be wrong, but I think this is because the video isn't saved yet in the database. It is attempting to set |
That was my assumption too, but if you remove the relationship between Product and Category, you can set an id to video and it will work fine (the video will get inserted with id 3 before product). I found this behavior strange because adding or removing a relationship shouldn't affect how the cascade of the other relationship functions |
Having the same issue with postgres |
Having similar issue with postgres. Any update on this? |
Same issue here with postgres. Any update on this? |
Same issue here using MySQL. |
Also facing this issue with MySQL. Works as soon as |
Issue Description
I feel I might be missing something but ManyToOne with cascade won't work for me if:
Expected Behavior
Should respect cascade and save both relationships
Actual Behavior
The nullable relationship cascade won't work and the main entity insert will throw an error:
Cannot add or update a child row: a foreign key constraint fails
Steps to Reproduce
My Environment
Additional Context
The bug won't occur if:
video.id = 3;
)Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: