On Fri, Apr 17, 2009 at 8:27 AM, Todd Benson <[email protected]> wrote: >> #i think something wrong here, but don't know right way to do this >> class CreateCommentsComments < Sequel::Migration >> def up >> create_table :comments_comments do >> primary_key :id >> foreign_key :comment_id, :comments >> foreign_key :parent_id, :comments >> end >> end >> def down >> drop_table :comments_comments >> end >> end > > Somebody may disagree with this, but this looks very much like an > "everything-is-an-association" taboo in database design (i.e. where > your relationship recursively defines the tuple). > > I can't speak for Sequel migrations, but this is most certainly the > wrong way to design a commenting system in a RDBMS. Okay, not "most > certainly", but 98% certainly. > > You can make it work, but it will kill you with the terrible queries > you'll have to write. Oh gosh, not to mention the insertions.
Sorry, should have been more clear. I_have_object -> and_it_has_a_many_to_many_relationship_with -> brother. Sounds like incest to me :-) The tuple (table) tries to do something the RDBMS already does. Bad, bad, bad !? hth, Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
