[Dbix-class] Cascading delete feature? no_cascade_delete => 1

Matt S Trout dbix-class at trout.me.uk
Tue Sep 20 08:28:08 CEST 2005


On Mon, Sep 19, 2005 at 10:59:11PM -0700, Fred Moyer wrote:
> Hi,
> 
> Last time I looked, an undocumented feature in Class::DBI 0.96 was the 
> ability to disable application side table cascading deletes and instead 
> let the database handle the cascades.  I searched the mailing list 
> subjects for the dbix-class archive looking for cascading deletes and 
> didn't find anything.
> 
> What is the current behavior of DBIx::Class with regards to cascading 
> dependencies?  I use PostgreSQL and prefer to have the database handle 
> cascading updates/deletes.

If you're using the CDBICompat layer has_many obeys the 0.96 rules, of
course.

DBIx::Class relationships take a cascade_delete => [01] attribute (and a
cascade_update which is more for might_have etc.); has_many sets cascade_delete
to 1 by default.

*however* DBIx::Class cascade delete does the search for the delete *after*
it's deleted the parent, so if your database already cascades the delete
then the DBIx::Class cascade won't find anything to hit - the idea being that
if you have the database handle it DBIC will stay out of your way :)

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list