[Koha-bugs] [Bug 7493] Deleting a record with comments breaks "Recent Comments"

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 6 16:06:45 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7493

--- Comment #1 from Owen Leonard <oleonard at myacpl.org> 2012-02-06 15:06:45 UTC ---
I think the solution to this problem is to add a foreign key constraint so that
when bibliographic or patron records are deleted the reviews table is updated.
I propose to:

- delete reviews when bibliographic records are deleted
- set set reviews.borrowernumber to NULL when patron records are deleted.

The database update making these changes will not run properly if there are
already instances of this bug--reviews with deleted biblios or patrons--so some
kind of update will have to be run in addition to setting the constraint.

Does anyone have any comments or suggestions about the efficiency/efficacy of
using these queries for that purpose?

DELETE FROM reviews WHERE biblionumber IN (SELECT biblionumber from
deletedbiblio);

UPDATE reviews SET borrowernumber = NULL WHERE borrowernumber IN (SELECT
borrowernumber FROM deletedborrowers);

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the Koha-bugs mailing list