Bugzilla – Attachment 143682 Details for
Bug 32162
erm_eholdings_packages_agreements does not have a primary key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32162: Add primar key to erm_eholdings_packages_agreements
Bug-32162-Add-primar-key-to-ermeholdingspackagesag.patch (text/plain), 3.31 KB, created by
Pedro Amorim
on 2022-11-10 16:09:36 UTC
(
hide
)
Description:
Bug 32162: Add primar key to erm_eholdings_packages_agreements
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2022-11-10 16:09:36 UTC
Size:
3.31 KB
patch
obsolete
>From 5fb63336d97461a6bbc1527fe65e68b3666a6d3f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Nov 2022 08:06:28 +0100 >Subject: [PATCH] Bug 32162: Add primar key to > erm_eholdings_packages_agreements > >Test plan: >Confirm that this change fixes the related TestBuilder.t failure >Confirm that it does not break the eRM app, try to attach an agreement >to a package. > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > .../data/mysql/atomicupdate/bug_32162.pl | 24 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 4 ++-- > 2 files changed, 26 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_32162.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_32162.pl b/installer/data/mysql/atomicupdate/bug_32162.pl >new file mode 100755 >index 0000000000..acfecddd4e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_32162.pl >@@ -0,0 +1,24 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "31162", >+ description => "Add primary key to erm_eholdings_packages_agreements", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ unless ( primary_key_exists('erm_eholdings_packages_agreements') ){ >+ $dbh->do(q{ >+ ALTER TABLE erm_eholdings_packages_agreements >+ DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_1, >+ DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_2, >+ DROP CONSTRAINT erm_eholdings_packages_agreements_uniq, >+ ADD PRIMARY KEY(`package_id`, `agreement_id`) >+ }); >+ $dbh->do(q{ >+ ALTER TABLE erm_eholdings_packages_agreements >+ ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE, >+ ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE >+ }); >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 54ed708304..60339a5020 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2975,9 +2975,9 @@ DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`; > CREATE TABLE `erm_eholdings_packages_agreements` ( > `package_id` INT(11) NOT NULL COMMENT 'link to the package', > `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', >- UNIQUE KEY `erm_eholdings_packages_agreements_uniq` (`package_id`, `agreement_id`), > CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE >+ CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, >+ PRIMARY KEY(`package_id`, `agreement_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >-- >2.25.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 32162
:
143622
|
143645
|
143682
|
143771