cozemble / monorepo

A data and process canvas
https://cozemble.com
Apache License 2.0
13 stars 1 forks source link

references-one and references-many relationships #3

Closed mike-hogan closed 1 year ago

mike-hogan commented 1 year ago

We have has-one and has-many relationships, which express containment relationships between parent and child models (think Invoice has-many Line Items, or Customer has-one address).

For the has-* relationships, if the parent is deleted, the children get deleted too. CASCADE DELETE in database terms.

What we need is similar, but without these delete semantics. For example, an Invoice would reference-one Customer. The Customer has a lifecycle independent of the Invoice. If the Invoice is deleted, the Customer remains. It is interesting to ask what should happen to an Invoice it its Customer get deleted.

A Mailing List might reference-many Customers. If the Mailing List is deleted the Customers remain.

These two relationship types unlock a super important part of modelling the graph of models to represent a domain.

mike-hogan commented 1 year ago

For the first milestone this is associated with, we will need references-one to allow a Bike Check to reference a Customer as a references-one, and the opposite as a references-many

mike-hogan commented 1 year ago

Completed a very basic implementation, with unbatched fetching of each referenced record. Will not scale, but enables the building of simple databases.