I am trying to find the most efficient manner of storing and querying this data structure.
Food Objects Table: https://i.stack.imgur.com/qs808.png
Food Relationships Table: https://i.stack.imgur.com/8XFgK.png
Desired resulting JSON when I query food where id = '8a2d7fde-13ef-4403-92a4-fcf518f27641' https://i.stack.imgur.com/gPMgm.png
So basically a food object can have an array of instances of any other food object along with custom settings/props/values for each instance/reference. Each instance can have its own children infinitely expanding down the tree as deep as the user wants to define the objects.