On Thursday, August 22, 2013 2:49:59 AM UTC-7, Adam Gamble wrote: > > Thanks Jeremy– Unions may be a good call, equally it'd be nice to have > just one 'Comment' table.. so to explain my situation I have a table > 'PhotoSet' and a 'Photo' table.. a user should be able to comment on a Set, > or a Photo –but for the purposes of the application the two should be > aggregated in a feed. > > As Photo's are many-to-one with the PhotoSet. I could have comments just > linked to the PhotoSet, where a comment *can* reference a Photo, > otherwise it becomes a general comment on the set.. make sense? >
I personally think you would be better off with both photo_comments and photoset_comments tables. You don't want a foreign_key in your photoset table referencing the comments table, since that lets you only have a single comment per photoset. Instead, the photo_comments table would have a foreign key referencing photos, and the photoset_comments table would have a foreign key referencing photosets. This allows you to have multiple comments per photo and per photoset. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
