Bugzilla – Attachment 160097 Details for
Bug 35610
Missing FK on old_reserves.branchcode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35610: Add FK on old_reserves.branchcode
Bug-35610-Add-FK-on-oldreservesbranchcode.patch (text/plain), 2.29 KB, created by
Jonathan Druart
on 2023-12-20 09:35:30 UTC
(
hide
)
Description:
Bug 35610: Add FK on old_reserves.branchcode
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-12-20 09:35:30 UTC
Size:
2.29 KB
patch
obsolete
>From a6fc688ab59a5396e8dbd6d869606ead7680a222 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Dec 2023 10:35:17 +0100 >Subject: [PATCH] Bug 35610: Add FK on old_reserves.branchcode > >--- > installer/data/mysql/atomicupdate/bug_35610.pl | 18 ++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > 2 files changed, 19 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_35610.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35610.pl b/installer/data/mysql/atomicupdate/bug_35610.pl >new file mode 100755 >index 00000000000..e9e2c107251 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35610.pl >@@ -0,0 +1,18 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35610", >+ description => "Add FK on old_reserves.branchcode", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ unless ( foreign_key_exists('old_reserves', 'old_reserves_ibfk_branchcode') ) { >+ $dbh->do(q{ >+ ALTER TABLE old_reserves >+ ADD CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE; >+ }); >+ say $out "Added foreign key on 'old_reserves.branchcode'" >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 0b59ad8d85c..c497ce77a73 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -4917,6 +4917,7 @@ CREATE TABLE `old_reserves` ( > CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL, > CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL, > CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL >+ CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > /*!40101 SET character_set_client = @saved_cs_client */; > >-- >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 35610
:
160097
|
160098
|
161540
|
163827
|
163966
|
163967
|
163968