registry icon indicating copy to clipboard operation
registry copied to clipboard

Registry server: Declarative database associations

Open theganyo opened this issue 2 years ago • 2 comments

Manually maintaining DB integrity can be quite error prone and should generally be done via rules. For example, the current model doesn't use foreign key constraints and we have to manually code relationship integrity during deletion (eg. for wipeout. We should transition to declarative association modeling as much as possible.

GORM can automatically create and maintain the common associations:

theganyo avatar Jun 28 '22 20:06 theganyo

It's unclear to me why there is a cascade option in storage/delete.go. Would cascade=false not leave the database in an inconsistent state?

theganyo avatar Jul 18 '22 17:07 theganyo

Sorry, I misread the intent: The cascade option is the same as the force field in AIP-135 - ie. If cascade is true, force delete the object and all its children. If cascade is false, fail if there are any children.

theganyo avatar Jul 18 '22 22:07 theganyo