Re: Cascading delete issues
[prev]
[thread]
[next]
[Date index for 2005/06/25]
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)
|