Q:

Correct mysql structure

I have a two variants of DB structure.
First:

Here is one comments table, and two special table 'news_comments' and 'photos_comments' which connect comment with material.
Second variants:

Here only 3 tables, without connector tables, but table comments have a special field 'type', which will be used with query. 
For example: SELECT * FROM comments WHERE type = 'news';

Question:
I don't know which variant is better. I think second, but is it correct?

A:

Unless a single comment can apply to more than one photo and/or news item, the 2nd option better represents and "enforces" the logical concept in data. But, I'd recommend replacing photos_id and news_id with item_id, which holds either a photos_id or a news_id, and changing type from a varchar to an enum('news','photo').
Again, this is under the assumption that any given comment applies to one news item or one photo, never both, and never more than one (which is usually how commenting systems work, eh?).

