http://www.perlmonks.org?node_id=954035


in reply to DBIx::Class::Schema::Loader and on_delete/cascade_delete

DBIx::Class::Schema::Loader is building your schema in a sensible manner.

If you delete a List, the database will correctly delete all of the associated Notifications. If you delete a Notification, cpan::DBIx::Class will correctly not delete the associated List. There is no need to delete Notifications in Perl given than the database already did it, and there is likewise no need to tell the database to not delete Lists, because it won't try to do that.

Note that it is more efficient to have on_delete => 'CASCADE' in the database rather than having to do a round trip through Perl to cascade deletes. However some users don't like it there because it makes it too easy to accidentally wipe all of your data when doing routine maintenance. I understand that making this optional is a feature request for a future version of DBIx::Class::Schema:::Loader.