I'm currently creating a document management system where the user should be able to configure the supported document types and therefor the documents attributes. My current conceptional ERD for the template looks like this:
but if i would like store my documents in this way, i it would create for each document with 2 attributes 3 entries in my database ( 1 for the document, and for each attribute another entry). In my opinion, i would do this the following way:
In my opinion, this doesn't look very cool. Is there another way to solve this?
Are the attributes a fixed set?
In this case the upper (m:n
) looks better, but I think you don't need the attribute name
but rather the actual value
in the mapping table. The mapping table may be enhanced by some columns to identify additional data like who, when, why and maybe - if needed - to allow sort of soft-delete.
The second is 1:n
and will define the same attribute names over and over.
Think in meta
and instance
: It is meta-data, how your attribute is named. You might define a complex meta-modell, which attributes fit to which context. You might introduce multi-language support. Only the value (and additional data describing the mapping itself) is instance-data.