Is the cascade delete rule right for me?

  • Hi,

    I'm trying to design a Core Data model for a server I'm working on,
    and I have a question about delete rules:  Can someone please verify
    for me that the "cascade" delete rule will only delete the objects at
    the destination of the relationship, and not cascade to any objects
    that those objects have a relationship to?

    Here's what my model looks like so far:

    SunSPOT
    ========
    several attributes;
    pendingCommands one-to-many relationship to SPOTCommand
        delete rule:  cascade (or should this be deny?)

    SPOTCommand
    =============
    three attributes;
    targetSPOT one-to-one relationship to SunSPOT (inverse of
    pendingCommands relationship)
    delete rule: nullify

    So to make my question more concrete, I want to make sure that if I
    delete a SunSPOT (assuming its delete rule is set to cascade), that
    won't also delete every targetSPOT that's in its pendingCommands --
    it'll just delete the SunSPOT and its pendingCommands, but not the
    targetSPOTs, right?

    Thanks,
    Sam
  • On Dec 2, 2007, at 4:52 PM, Sam Stigler wrote:

    > I'm trying to design a Core Data model for a server I'm working on,
    > and I have a question about delete rules:  Can someone please verify
    > for me that the "cascade" delete rule will only delete the objects
    > at the destination of the relationship, and not cascade to any
    > objects that those objects have a relationship to?
    >
    The delete rule applies just to the destination of that relationship.
    If you've set a cascade rule, what happens thereafter depends on the
    rules for the relationships of the destination objects.

    mmalc
  • Okay; thanks.  That clears it up.

    Sam

    On Dec 2, 2007, at 7:59 PM, mmalc crawford wrote:

    >
    > On Dec 2, 2007, at 4:52 PM, Sam Stigler wrote:
    >
    >> I'm trying to design a Core Data model for a server I'm working
    >> on, and I have a question about delete rules:  Can someone please
    >> verify for me that the "cascade" delete rule will only delete the
    >> objects at the destination of the relationship, and not cascade to
    >> any objects that those objects have a relationship to?
    >>
    > The delete rule applies just to the destination of that
    > relationship.  If you've set a cascade rule, what happens thereafter
    > depends on the rules for the relationships of the destination objects.
    >
    > mmalc
    >
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today