Skip to content

implement foreignkey arrays for one_to_many relations #185

@coeit

Description

@coeit

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

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions