Bugzilla – Attachment 83366 Details for
Bug 21065
Data in account_offsets and accountlines is deleted with the patron leaving gaps in financial reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19850: (QA follow-up) Make the update idempotent
Bug-19850-QA-follow-up-Make-the-update-idempotent.patch (text/plain), 2.96 KB, created by
Martin Renvoize
on 2018-12-18 14:01:35 UTC
(
hide
)
Description:
Bug 19850: (QA follow-up) Make the update idempotent
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2018-12-18 14:01:35 UTC
Size:
2.96 KB
patch
obsolete
>From d21eb3f0dcc5d8f73e196747e631408bbf167464 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 18 Dec 2018 13:52:15 +0000 >Subject: [PATCH] Bug 19850: (QA follow-up) Make the update idempotent > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >https://bugs.koha-community.org/show_bug.cgi?id=21065 >--- > .../data/mysql/atomicupdate/bug_21065.perl | 22 +++++++++++-------- > installer/data/mysql/kohastructure.sql | 2 +- > 2 files changed, 14 insertions(+), 10 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_21065.perl b/installer/data/mysql/atomicupdate/bug_21065.perl >index 8c732da964..443877b08f 100644 >--- a/installer/data/mysql/atomicupdate/bug_21065.perl >+++ b/installer/data/mysql/atomicupdate/bug_21065.perl >@@ -1,15 +1,19 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > >- $dbh->do(q| >- ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_1; >- |); >- $dbh->do(q| >- ALTER TABLE accountlines CHANGE COLUMN borrowernumber borrowernumber INT(11) DEFAULT NULL; >- |); >- $dbh->do(q| >- ALTER TABLE accountlines ADD CONSTRAINT accountlines_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE; >- |); >+ my $sth = $dbh->prepare(q|SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_NAME='accountlines_ibfk_1'|); >+ $sth->execute; >+ if ($sth->fetchrow_hashref) { >+ $dbh->do(q| >+ ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_1; >+ |); >+ $dbh->do(q| >+ ALTER TABLE accountlines CHANGE COLUMN borrowernumber borrowernumber INT(11) DEFAULT NULL; >+ |); >+ $dbh->do(q| >+ ALTER TABLE accountlines ADD CONSTRAINT accountlines_ibfk_borrowers FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE; >+ |); >+ } > > SetVersion( $DBversion ); > print "Upgrade to $DBversion done (Bug 21065 - Set ON DELETE SET NULL on accountlines.borrowernumber)\n"; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 9b45f15d15..8a8ca49122 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2722,7 +2722,7 @@ CREATE TABLE `accountlines` ( > KEY `acctsborridx` (`borrowernumber`), > KEY `timeidx` (`timestamp`), > KEY `itemnumber` (`itemnumber`), >- CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `accountlines_ibfk_borrowers` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, > CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > >-- >2.19.2
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 21065
:
83220
|
83221
|
83222
|
83223
|
83224
|
83235
|
83236
|
83237
|
83238
| 83366