I am storing tags to posts as a many-to-many relationship, like in this post.
I now want to extend tags to be able to tag entities other than posts. I have all these in tables named posts, links, articles, etc. Should I opt for:
tags_items
tag_id | item_id | item_type
-----------------------------
1 2 post
1 42 link
3 7 article
Or create multiple tables
tags_posts
tag_id | post_id
tags_links
tag_id | link_id
tags_article
tag_id | article_id
This forces me to create a new table for every entity I want to tag, but it makes it easier for me to enforce referential integrity.
What are advantages and disadvantages to each approach?