Reputation: 191
Let's say you have a list of entities: Post, Question, and Gallery and these entities can be liked and commented on by a user and also hold tags.
Would would it be a good idea to compact things so there's not a bunch of tables (Option 1) or is it better to create as many tables as necessary although the tables will look very similar to each other (Option 2).
Option 1
enitity
entity_type
post
gallery
question
tag
like_
comment
tag_to_entity
Option 2
tag
post
gallery
question
like_to_post
like_to_gallery
like_to_gallery
comment_to_post
comment_to_gallery
comment_to_question
tag_to_post
tag_to_gallery
tag_to_question
Upvotes: 0
Views: 91
Reputation: 265
I would say option 2 is preferable because:
Upvotes: 1