3

I have the following scenerio:

  • There are some categories
  • Each category has attributes
  • An attribute could be of free text or collection of options
  • There is a product which is assigned to category which needs to store values/options of attributes

How can a model be made without any repetition, and which correctly addresses the polymorphic nature of attributes?

A-K
7,4443 gold badges35 silver badges52 bronze badges
asked Oct 3, 2013 at 11:15
1
  • Is the free text attribute can't be an option and become a collection with only one option ? Commented Oct 3, 2013 at 11:40

1 Answer 1

2

I would design a meta-data/value based model, as:

enter image description here

Or, where formality is enforced,

enter image description here

Being AttributeCode and ValueCode unique, textual, human-readable identifiers, alongside the corresponding AttributeId and ValueId.

For instance, the hypothetical meta-attribute length, physically stored with AttributeId = 1, would (should!) be referenced in specific queries as AttributeCode = 'LENGTH'.

(of course, AttributeCode and ValueCode could compose the PKs... but I personally prefer PKs columns to be integer-only)

answered Oct 4, 2013 at 6:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.