Bugzilla – Attachment 185516 Details for
Bug 40665
Add booking_id field to issues to link checkouts to bookings that were fulfilled by them
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40665: Atomic update
Bug-40665-Atomic-update.patch (text/plain), 2.53 KB, created by
Paul Derscheid
on 2025-08-18 15:48:07 UTC
(
hide
)
Description:
Bug 40665: Atomic update
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2025-08-18 15:48:07 UTC
Size:
2.53 KB
patch
obsolete
>From 45b2fa1f33fd17a8797a9abbf9be164369c7ada3 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Mon, 18 Aug 2025 15:40:05 +0000 >Subject: [PATCH] Bug 40665: Atomic update > >--- > ..._40665-add_booking_id_issues_old_issues.pl | 55 +++++++++++++++++++ > 1 file changed, 55 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_40665-add_booking_id_issues_old_issues.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_40665-add_booking_id_issues_old_issues.pl b/installer/data/mysql/atomicupdate/bug_40665-add_booking_id_issues_old_issues.pl >new file mode 100644 >index 00000000000..ccddf61918b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40665-add_booking_id_issues_old_issues.pl >@@ -0,0 +1,55 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "CHANGEME", >+ description => "Add booking_id to issues and old_issues tables to link checkouts to bookings", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ if ( !column_exists( 'issues', 'booking_id' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE issues >+ ADD COLUMN booking_id int(11) DEFAULT NULL >+ COMMENT 'foreign key linking this checkout to the booking it fulfills' >+ AFTER itemnumber >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE issues >+ ADD CONSTRAINT issues_booking_id_fk >+ FOREIGN KEY (booking_id) REFERENCES bookings(booking_id) >+ ON DELETE SET NULL ON UPDATE CASCADE >+ } >+ ); >+ >+ say_success( $out, "Added column 'issues.booking_id'" ); >+ } >+ >+ if ( !column_exists( 'old_issues', 'booking_id' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE old_issues >+ ADD COLUMN booking_id int(11) DEFAULT NULL >+ COMMENT 'foreign key linking this checkout to the booking it fulfilled' >+ AFTER itemnumber >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE old_issues >+ ADD CONSTRAINT old_issues_booking_id_fk >+ FOREIGN KEY (booking_id) REFERENCES bookings(booking_id) >+ ON DELETE SET NULL ON UPDATE CASCADE >+ } >+ ); >+ >+ say_success( $out, "Added column 'old_issues.booking_id'" ); >+ } >+ }, >+}; >-- >2.39.5
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 40665
:
185516
|
185517
|
185518
|
185519
|
185520
|
185895
|
185896
|
185897
|
185898
|
185899
|
186250
|
186369
|
187589