Let's say I have a Product
and a ProductType
table. I want a table where I can store special columns for each product type. The special columns (attributes) can be of any type.
Right now we have a table per ProductType
called Product_%ProductTypeId%
which is a solution I really don't like - any suggestions ?
My idea was to have a table ProductTypeColumns
with cols:
Id | ProductTypeId | ColumnName | Value | ColumnType
what I don't like about this is that I'm losing type safety, column Value
would be a string type which would mean I have to always convert to and from.
Plus this table will be used in generating reports.. having "dynamic" columns may be a problem.