Bug 28972: Add missing foreign key constraints to holds queue table

The table tmp_holdsqueue is missing a couple key constraints that should
be there, one for biblio and one for borrowers.

Test Plan:
1) "SHOW CREATE TABLE tmp_holdsqueue;" should show no FKs for biblio or borrowers
2) Apply this patch
3) Run updatedatabase.pl
4) "SHOW CREATE TABLE tmp_holdsqueue;" should now show FKs for biblio or borrowers

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Kyle M Hall 2021-09-08 08:02:05 -04:00 committed by Jonathan Druart
parent 5bbafce720
commit 7170fe2cc5
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,15 @@
use Modern::Perl;
return {
bug_number => "28972",
description => "Add missing foreign key constraints to holds queue table",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
ALTER TABLE tmp_holdsqueue
ADD CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
});
},
}

View File

@ -5103,7 +5103,9 @@ CREATE TABLE `tmp_holdsqueue` (
`notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`item_level_request` tinyint(4) NOT NULL DEFAULT 0,
KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`),
CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;