Koha/installer/data/mysql/atomicupdate/bug_13534.sql
Jonathan Druart fb419ba83d Bug 13534: Do not remove tags on deleting a patron
On deleting a patron, all the tags approved by this user will be
deleted.
This can cause data lost.

Test plan:
0/ Do not execute the update DB entry
1/ Create 2 patrons A, B
2/ Create some tags with patron A logged in
3/ Approve them with patron B logged in
4/ Delete the 2 patrons
=> The tags have been deleted
5/ Execute the DB entry
6/ Repeat 1,2,3,4
=> The tags have not been deleted and are still shown on the interface
(result, detail, tags module)

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-02-23 15:25:49 +00:00

6 lines
541 B
SQL

ALTER TABLE tags_all MODIFY COLUMN borrowernumber INT(11);
ALTER TABLE tags_all drop FOREIGN KEY tags_borrowers_fk_1;
ALTER TABLE tags_all ADD CONSTRAINT `tags_borrowers_fk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE tags_approval DROP FOREIGN KEY tags_approval_borrowers_fk_1;
ALTER TABLE tags_approval ADD CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE;