So below is a beginning structure to part of my data that im trying to setup for a notes app. This notes app will have the ability to have folder and sub folder, and sub folders with in that folder. Think like a Windows File Explorer type of feel. I'm fairly new to Supabase and new to complex data structures. My idea was to nest the sub folders in a "children" array column/cell. The reason for this is so i could easily map through and render the sub-folder component. My question is this, would this be efficient and the way Supabase is set up does it allow for this, or is there some sort of relation setup i need to do like when i associate a user to this data eventually. Would i want to store maybe the id's in the children array and then make another data call. I know i have unlimited requests but how would this affect my data transfer in the long run do you suspect? Essentially what would be the smartest way to store this data.
const menuItems = [
{name: "A Test Directory", id: 1, parent_id: null, children: []},
{
name: "C Test Directory2", id: 2, parent_id: null, children: [
{name: "B Test sub-Directory1", id: 5, parent_id: 2, children: []},
{name: "A Test sub-Directory2", id: 6, parent_id: 2, children: []},
]
},
{
name: "B Test Directory3", id: 3, parent_id: null, children: [
{name: "Test sub-Directory3", id: 7, parent_id: 3, children: []},
]
},
{
name: "D Test Directory4", id: 4, parent_id: null, children: [
{name: "Test sub-Directory4", id: 8, parent_id: 4, children: []},
]
},
];