[Dbix-class] bug in delete_all: CascadeActions::delete removes parent before children

Jess Robinson castaway at desert-island.me.uk
Sat Oct 25 12:16:34 BST 2008



On Fri, 24 Oct 2008, Noel Burton-Krahn wrote:

> DBIx's cascading delete_all (in DBIx::Class::ResultSet) it broken,
> because it deletes the parent table before it deletes the children.
> The database will throw a referential integrity exception when the
> parent is deleted before the children.    I've attached a test program
> below.  Here's a fixed version in

This is intentional. DBICs cascade delete / relationship support deletes 
in this fashion so that it does not get in the way of your database itself 
doing it.

Either: Let DBIC do the deleting in this way for you, or turn off DBICs 
cascading and let your database do it.

Jess




More information about the DBIx-Class mailing list