Bugzilla – Attachment 103039 Details for
Bug 13535
Table alert is missing FK and not deleted with the patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
32# Attachment to Bug 13535 - Table alert is missing FK and not deleted with the patron
Bug-13535-Add-FK-constraint-on-borrowrnumber-to-al.patch (text/plain), 2.71 KB, created by
Katrin Fischer
on 2020-04-15 22:07:21 UTC
(
hide
)
Description:
32# Attachment to Bug 13535 - Table alert is missing FK and not deleted with the patron
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-04-15 22:07:21 UTC
Size:
2.71 KB
patch
obsolete
>From a54c6028d02fa35baa88d6ab4edc0c6ae10ab8ce Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Sun, 12 Apr 2020 20:52:11 +0000 >Subject: [PATCH] Bug 13535: Add FK constraint on borrowrnumber to alert table > >When a patron is deleted, we should clean up the data connected >to the patron. This includes subscriptions to 'new issue arrived' >arrive messages from the serials module. > >To test: > >Part1: >- Apply patch >- Run updatedatabase - verify no error message >- Run updatedatabase again - verify still no error message >- Add a subscription and select a notice template for patron notification >- Log in as any patron (not yourself) and subscribe to the email alert > in the OPAC >- Veriy on the subscription detail page, that the patron is subscribed > in staff >- Note borrowernumber and delete patron >- SELECT * from alert; in a report >- There should no longer be an entry with the borrowernumber >Part 2: >- Start fresh with the web installer, verify there are no errors on > creating the database tables >--- > .../data/mysql/atomicupdate/bug_13535_alert_constraint.perl | 11 +++++++++++ > installer/data/mysql/kohastructure.sql | 3 ++- > 2 files changed, 13 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_13535_alert_constraint.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_13535_alert_constraint.perl b/installer/data/mysql/atomicupdate/bug_13535_alert_constraint.perl >new file mode 100644 >index 0000000000..194fca938f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_13535_alert_constraint.perl >@@ -0,0 +1,11 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ unless ( foreign_key_exists( 'alert', 'alert_ibfk_1' ) ) { >+ $dbh->do( >+ qq{ >+ ALTER TABLE alert ADD CONSTRAINT alert_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON UPDATE CASCADE ON DELETE CASCADE >+ } >+ ); >+ } >+ NewVersion( $DBversion, 13535, "Add FK constraint on borrowernumber to alert table"); >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 740b5958c8..9205c8940c 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2768,7 +2768,8 @@ CREATE TABLE `alert` ( > `externalid` varchar(20) NOT NULL default '', > PRIMARY KEY (`alertid`), > KEY `borrowernumber` (`borrowernumber`), >- KEY `type` (`type`,`externalid`) >+ KEY `type` (`type`,`externalid`), >+ CONSTRAINT alert_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON UPDATE CASCADE ON DELETE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13535
:
103039
|
108272
|
108275
|
110194
|
111076