Let's say you want to build a CRM system and you want to store files for customers. This is one way how you could do that.
Start with, you would have two tables:
customers- Customer data.
customer_files- What file belongs to what customer
- customer_id (Foreign Key to `customers.id`)
- file_id (Foreign Key to `storage.files.id`)
You would also create a Hasura Relationship (GraphQL relationship) between between
customer_files and between
With the two tables and GraphQL relationships in place, you can query customers and the customer's files like this:
# customers table
# customer_files table
# storage.files table
The file upload process would be as follows:
- Upload a file.
- Get the returned file id.
- Insert (GraphQL Mutation) the file
idand the customer's
This would allow you to upload and download files belonging to specific customers in your CRM system.