You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is expected: the onDelete action is SET NULL- Which means when deleting the referenced item, the database would try to set this column to NUL,L which would break this constraint - so MySQL prevent you from doing this.
( Interestingly, PostgreSQL doesn't complain about it until we actually try to delete the referenced item ).
We could disable the onDelete option and set it to CASCADE automatically when a user makes a relational field non nullable like in your case, but it might not be expected to some users and lead to mistakes. Ultimately it's probably better to leave it as is...
Ah, that makes sense but it was not obvious to me at all. I'd be fine disabling one of the two, or throwing a notification when both are set... at least explaining to users that they can't do this (before they save and get this technical error).
Preflight Checklist
Describe the Bug
I get a foreign key constraint error when trying to create/edit a M2O field with
Nullable
disabled (unchecked).To Reproduce
Errors Shown
See above.
What version of Directus are you using?
RC.99
What version of Node.js are you using?
7.20.3
What database are you using?
MySQL 5.7.26
What browser are you using?
Chrome
What operating system are you using?
MacOS
How are you deploying Directus?
locally
The text was updated successfully, but these errors were encountered: