I have an app where users store links in “folders”. The way that I have it set up right now, there are 4 tables.
- A table of “links”
- A table for “folders”
- A table that ties the “links” to their parent “folders”
- A final table houses the “relationships” between those folders. It has a column for the ID of the parent folder and an ID for the child folder.
In this manner, I can have any number of parent and children folders and place those links anywhere. I can display the data in folder format with the links in the proper locations.
The problem is that I would like to be able to pull down the most recent “links” placed into any folder – including all children folders. So, if a user is looking at a top level folder, I would show the 5, 10, or whatever most recent links within it and all subfolders. I don’t feel like the current setup is optimal for this. What setup should I use? The app isn’t so far along that I can’t redo the structure.