[Dbix-class] Order of operations in CascadeActions::delete

Matt S Trout dbix-class at trout.me.uk
Tue May 8 12:52:58 GMT 2007


On Tue, Apr 24, 2007 at 02:25:57PM +0100, Pedro Melo wrote:
> First, I agree with you that cascade delete on the database side is  
> probably best, and that the db-side cascading delete taking  
> preference is documented in the Relationship.pm perldoc.
> 
> But allowing DBIC to perform the delete itself is useful when you  
> have extra business logic attached to the delete action.

If you have business logic attached then you can override delete and do
whatever you like in there.

The automatic code is intentionally written the way it is because I've seen
naive programmers cause massive data loss with Class::DBI's reverse approach.

If you want to override the DB's FK settings, you get to do it by hand so it's
Bloody Obvious (tm) in the code that that's what's going to happen. It's safer
and more maintainable that way, IME.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
Shadowcat Systems Ltd.   Contact mst (at) shadowcatsystems.co.uk for a quote
                                          http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list