Bugzilla – Attachment 128439 Details for
Bug 29605
DB structure may not be synced with kohastructure.sql
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29605: Missing FK on tmp_holdsqueue.borrowernumber (tmp_holdsqueue_ibfk_3)
Bug-29605-Missing-FK-on-tmpholdsqueueborrowernumbe.patch (text/plain), 2.80 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-12-13 11:15:41 UTC
(
hide
)
Description:
Bug 29605: Missing FK on tmp_holdsqueue.borrowernumber (tmp_holdsqueue_ibfk_3)
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-12-13 11:15:41 UTC
Size:
2.80 KB
patch
obsolete
>From 5c12dbc5881898b29449c776e43a6dd66091574b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 2 Dec 2021 12:12:10 +0100 >Subject: [PATCH] Bug 29605: Missing FK on tmp_holdsqueue.borrowernumber > (tmp_holdsqueue_ibfk_3) > >Bad copy paste on the foreign_key_exists condition > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > installer/data/mysql/atomicupdate/bug_29605.pl | 16 ++++++++++++++-- > installer/data/mysql/db_revs/210600022.pl | 2 +- > 2 files changed, 15 insertions(+), 3 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_29605.pl b/installer/data/mysql/atomicupdate/bug_29605.pl >index 4a2cfe022e..a18e8ecccc 100755 >--- a/installer/data/mysql/atomicupdate/bug_29605.pl >+++ b/installer/data/mysql/atomicupdate/bug_29605.pl >@@ -2,10 +2,10 @@ use Modern::Perl; > > return { > bug_number => "29605", >- description => "Add language_script_mapping primary key", >+ description => "Resync DB structure for existing installations", > up => sub { > my ($args) = @_; >- my ($dbh) = @$args{qw(dbh)}; >+ my ($dbh, $out) = @$args{qw(dbh out)}; > > if ( !primary_key_exists( 'language_script_mapping', 'language_subtag' ) > and index_exists( 'language_script_mapping', 'language_subtag' ) ) { >@@ -22,6 +22,18 @@ return { > ALTER TABLE language_script_mapping > ADD PRIMARY KEY `language_subtag` (`language_subtag`); > }); >+ >+ say $out "Added missing primary key on language_script_mapping" > } >+ >+ unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) { >+ $dbh->do(q{ >+ ALTER TABLE tmp_holdsqueue >+ ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE >+ }); >+ >+ say $out "Added missing foreign key on tmp_holdsqueue" >+ } >+ > }, > } >diff --git a/installer/data/mysql/db_revs/210600022.pl b/installer/data/mysql/db_revs/210600022.pl >index 12f52eac15..f3a7c692e1 100755 >--- a/installer/data/mysql/db_revs/210600022.pl >+++ b/installer/data/mysql/db_revs/210600022.pl >@@ -12,7 +12,7 @@ return { > ADD CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE > }); > } >- unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_2') ) { >+ unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) { > $dbh->do(q{ > ALTER TABLE tmp_holdsqueue > ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE >-- >2.34.1
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 29605
:
128113
|
128114
|
128152
|
128153
|
128154
|
128155
|
128156
|
128157
|
128158
|
128239
|
128313
|
128314
|
128437
|
128438
|
128439
|
128440
|
128441
|
128442
|
128443
|
128444
|
128445
|
128483
|
129153
|
129154
|
129155
|
129156
|
129157
|
129158
|
129159
|
129160
|
129161