jeudi 14 janvier 2016

"Attachment" table for different entities

I have the more than 10 tables, each table represents an entity that can hold "attachments":

Documents
Absence
Assignments
.....

The Attachment table currently has the following fields: Id, ParentType, ParentId, Attachment

I think this is bad design, because no constraints, other option would be creating an attachment table for each entity type. This is a lot of work and is not generic. Soon I will be adding more types and then create more attachment tables, just not practical.

What's the best design for this scenario?

Aucun commentaire:

Enregistrer un commentaire