Forum OpenACS Q&A: Response to Categories in BBOARDS

Collapse
Posted by Don Baccus on
Restricting deleting to categories with no threads is fine.

In general, one way to consider handling deletion of stuff like categories (not just in bboard) is to

1. Check for existing items using the category, and provide a means to list them and fix them rather than just output an error message if any references exist.

2. Use "on delete set null" to maintain referential integrity, then
provide a page that lists them so you can fix them.

3. Use "on delete cascade", i.e. delete all the items.  This is dangerous, if every "references" relationship ends up "on delete cascade" then a simple delete can cascade throughout the db getting rid of a lot more things than the admin expected.

So #3 should be used with great care, #1's probably safest, #2 lies somewhere between.