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?

Adam

On Wednesday, 21 August 2013 16:41:14 UTC+1, Jeremy Evans wrote:
>
> On Wednesday, August 21, 2013 8:05:10 AM UTC-7, Adam Gamble wrote:
>>
>> Hi all,
>>
>> Just looking for some opinions on the following scenario, not very 
>> experience with database design.. I have two tables (A, B) that both 
>> require a comments column that would relate to a comments table (C).
>>
>> Presently it seems like I want two different comment tables (C.A, C.B) to 
>> create the `one_to_many` `many_to_one` relationships in the Models. I do, 
>> however, sometimes need to aggregate all comments.. is there a way to 
>> implement this association in Sequel?
>>
>
> Well, it really depends on your needs.  You can use separate tables, but 
> then aggregation requires doing it in the application or using a UNION in 
> SQL.
>
> You can always use a single comments table that both A and B reference, 
> but this would allow rows from both A and B to reference the same comment.
>
> To provide more help you'd probably have to be more specific, by posting 
> your proposed schema and exactly what types of associations you want.
>
> 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.

Reply via email to