Forum OpenACS Development: Re: Clean delete of packages

Collapse
Posted by Don Baccus on
You wouldn't want to use ON DELETE CASCADE blindly, of course.  Judicious use would really simplify a lot of code, though.  I had this argument with Richard Li and others three years ago and lost, though.

The unpaid invoices problem can be solved a couple of different ways ... don't use ON DELETE CASCADE for this particular case or use it but define a BEFORE trigger on the users table and block the deletion of a user if there's an unpaid invoice, while allowing it to go through if there's not.

I'd rather deal with special cases like this than the current mess we have where a bunch of different packages won't let you delete things.

For instance my last round of commits involved fixing the notifications package so you can delete a notification request if there are still unsent notifications pending.  Rather than bomb, which is what it did until I fixed it.

Whether you disagree or not, though, don't worry ... writing upgrade scripts to add the constraints and modify the various delete procs would be a extremely painful process, particularly in current versions of PG with its rather weak ALTER command.