Re: Mapping fake FKs as relationships?

From: Kevin Menard (nirvdru..mail.com)
Date: Sun Jan 10 2010 - 20:46:21 EST

  • Next message: Aristedes Maniatis: "Re: Type-safe qualifiers"

    On Sun, Jan 10, 2010 at 8:21 PM, Aristedes Maniatis <ar..aniatis.org>wrote:

    > On 11/01/10 12:08 PM, Kevin Menard wrote:
    >
    >> More complicated would be AR's notion of polymorphic relationships, which
    >> I
    >> guess were added as a way to avoid join tables.
    >>
    >
    > My coincidence Lachlan Deck and I were discussing this just this morning.
    > We have to think about what is involved, but what about an interface you can
    > define in CM on which you can then perform a Query? Then rather than forcing
    > inheritance on users, you could just define an interface.
    >
    > The common examples (as per the original poster) are attachments, comments
    > and tags. So you want to be able to define a Taggable interface implemented
    > by Artists, Paintings, etc. That then ties back to Tags and a special
    > many-many Taggable_Tags join table with "foreign_key" and "foreign_table"
    > fields. This implementation looks a lot like vertical inheritance, but
    > without the inheritance.
    >

    So, the problem I've always had with this approach is that renaming a table
    invalidates your data. Additionally, you're always doing a join on a
    varchar field for which an index may not buy you a whole lot (best case is a
    1/n partitioning). The benefit is you don't need n join tables.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Sun Jan 10 2010 - 20:47:14 EST