I just need some advice about using tags. I’m working on a website right now and the users can post videos, images, audio and information about themselves.
I never worked with tags before on a normal website (did work with them on wordpress, youtube etc..), so I need some advise to start designing my database.
What is the common way to work with tags when you have multiple categories? Do I have to add tags for each category?
Example:
Table:
gallery
gallery_id
image
tags
Table
audio
audio_id
title
link
audio_tags
Etc...
Or do I make only one table named “tags” and all the tags in it?
Like:
Table Tags:
tag_id
tag
Thanks in advance.
It depends if you want tags to be shared among multiple objects. If you want that to be separate, then i would make separate tag tables for them. If not, I would have the same tag table, and use different tables for each relation the tags will have, so
for separate:
for not separate:
you could also do this with one ploymorphic table. with a table with something like this: