Re: Cascading delete issues

[prev] [thread] [next] [Date index for 2005/06/25]

From: Bill Moseley
Subject: Re: Cascading delete issues
Date: 20:11 on 25 Jun 2005
On Sun, Feb 20, 2005 at 11:13:10AM +0000, Tony Bowden wrote:
> In the dim and distant past, Tim Bunce wrote:
> > I think the on-delete behaviour should be defined with the relationship.
> > In other words has_many() should let you specify on-delete actions like
> > cascade, restrict, set-null. That would match the behaviour of
> > databases, which allow on-delete actions to be associated with
> > foreign-key relationships.
> > CD->has_many('tracks', 'Track' => 'cd', { on_delete => 'restrict' });
> 
> I've finally implemented this. However, I've done it in a manner that
> lets anyone write their own strategies for what they want to happen
> here.
> 
> The default implicit behaviour is still:
>   CD->has_many(tracks => 'Track', { cascade => 'Delete' });

Tony, is this not going to be in the 1.00 release?


The issue I had was in a User, Role, UserRole many-to-many if I do:

    $role->delete;

CDBI does the cascade first so all the UserRole link entires get
removed before the $role is deleted.  This means the constraint in the
database doesn't catch the dependency.  I can override Role::delete
and test for entries in the link table first, of course.



        -- 
        Bill Moseley
moseley@xxxx.xxx

(message missing)

Re: Cascading delete issues
Tony Bowden 11:13 on 20 Feb 2005

Re: Cascading delete issues
Bill Moseley 20:11 on 25 Jun 2005

Re: Cascading delete issues
Tony Bowden 07:46 on 27 Jun 2005

RE: Cascading delete issues
Addison, Mark 20:15 on 21 Feb 2005

Re: Cascading delete issues
Tony Bowden 22:23 on 21 Feb 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52