Bug 13535: Add FK constraint on borrowernumber to alert table
commitffd10c34e252745356c3bef5d3b588fd35d3e5b5
authorKatrin Fischer <katrin.fischer.83@web.de>
Sun, 12 Apr 2020 20:52:11 +0000 (12 20:52 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 8 Oct 2020 14:18:18 +0000 (8 16:18 +0200)
treeacdaef348b62fdd1102b63e8c41c9f09685668aa
parent42761560c4f3d6014fac920b8a5a295c2ccb5801
Bug 13535: Add FK constraint on borrowernumber 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:
- Before applying the patch
- Add a subscription and select a notice template for patron notification
- Go to the OPAC and subscribe to the email alert
- Log in as any other patron (not yourself) and subscribe with that patron too
- Verfiy on the subscription detail page, that the patrons are subscribed
- Note the borrowernumber of your patrons
- Delete the second patron
- Note borrowernumber and delete patron
- Run: SELECT * from alert; in a report
- Despite the patron being deleted, you will see entries for both
- Apply patch
- Run updatedatabase - verify no error message
- Run updatedatabase again - verify still no error message
- There should no longer be an entry with the deleted borrowernumber,
  but only the entry for your own patron account
Part 2:
- Start fresh with the web installer, verify there are no errors on
  creating the database tables

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_13535_alert_constraint.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql