[Dbix-class] Disable cascading delete, but then...?

Jesse Sheidlower jester at panix.com
Sun Jun 12 10:53:01 GMT 2011


I'm working on a new app, where I have a "main" table called "word",
that belongs_to some other tables, including "status".

While testing a proof-of-concept version of this app, a colleague made
the obvious discovery that if you delete a status, you'll also
(cascadingly) delete all the words having that status. This is bad.
However, if I just set cascade_delete => 0 for the relationship,
deleting the status will result in these words having a status_id column
that points to a nonexistent row.

Are there standard ways of dealing with this automatically, so that, for
example, deleting the status will instead set the status_id column of
all related words to NULL? Or what else are the usual solutions?

Jesse Sheidlower



More information about the DBIx-Class mailing list