-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Summary
Currently foreignkey arrays are supported when using a many_to_many relation. Even though it might be weird e.g. for relational databases we can also implement a many_to_one / one_to_many relation via a foreignkey array stored on the one_to_many side of the association.
Implementation
Instead of updating both sides of the association (both fK arrays) we only need to update the model that holds the array, similiar to how in the standard case (one foreign key) we update only the model that holds the foreignkey. We do this by calling the function to update the array in the model that holds the foreign-key.
For details look at the implementation of updating foreignkeys for the different storage types.
data-model-definition
To differentiate between the standard (one foreignkey on the many_to_one end) way of associating records and the foreignkey array (stored on the one_to_many) we can look at the association type and where the targetkey is stored (see above). Both will have implementation: "foreignkeys".
Spec
Pending