XataX
Xata15mo ago
almac2017

Links (Relationships) database structure and filter / query approach

Hi everyone, I am very new to Xata and databases generally and I am trying to build a small web app. I am using Next.js Latest, typescript.
I am looking for some guidance on setup and then filtering the data, so any help would be appreciated:

The situation I have is:

sub tasks (Many) -> Task (Many) -> milestone (Many) - Project (many) - Team / organisation (One)

The Table structure I thought of:
  • Sub_task (many-to-one) -- Link to task.id
  • Task (Many-to-one) -- Link to Milestone.id
  • Milestone (many-to-one) -- Link to Project.id
  • Project (Many-to-one) -- Link to Organisation.id
  • Organisation (one)
Question: Is the above overkill or am on the right path?

The follow up would be then I would need to filter and display the sub tasks against the task, then against the milestone etc etc, as these fields are dynamic I am not sure how to build the query for this either which is efficient and will allow me to display the data in a grid format where all the sub tasks will display under the respective task etc etc.

I have created the picture to try and help my thought process.

Thank you in advanced for any help or suggestions.
xatastructure.png
Was this page helpful?