Answer the question
In order to leave comments, you need to log in
How to design such a database?
There is a table with objects (addresses up to the apartment). An application is created for each apartment. The application contains comments. But both in the application and in the comments there can be attached files.
Now these are 4 tables: objects, applications, comments, files.
Accordingly, it will be necessary to receive files both for a specific comment, and for an application and at an address. The last point will force you to write a resource-intensive query. Which will first find all applications attached to the object, then all comments for each, and then files for each comment. I think it's very crooked. How to do it right? Thanks
Answer the question
In order to leave comments, you need to log in
Of course, it depends on the number of records and requests, perhaps there is no problem, and even with the scenario described, everything will be fine.
If the logic allows (the file refers to only one comment, the comment to one ticket, the ticket to one object), then you can add a link that simplifies the query. For example, for files, add a field for the object id. Accordingly, it incurs some costs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question