Bugzilla – Attachment 186394 Details for
Bug 40528
Issue After Updating Koha to 25.05.02 – Member Search Error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40528: Atomicupdate
Bug-40528-Atomicupdate.patch (text/plain), 5.62 KB, created by
Paul Derscheid
on 2025-09-15 07:26:10 UTC
(
hide
)
Description:
Bug 40528: Atomicupdate
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2025-09-15 07:26:10 UTC
Size:
5.62 KB
patch
obsolete
>From 25bbdefd2bf85b00392285a67ece5a973c07281f Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Mon, 15 Sep 2025 09:25:34 +0200 >Subject: [PATCH] Bug 40528: Atomicupdate > >--- > .../bug_40528-rerun_db_rev_250501001.pl | 116 ++++++++++++++++++ > 1 file changed, 116 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_40528-rerun_db_rev_250501001.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_40528-rerun_db_rev_250501001.pl b/installer/data/mysql/atomicupdate/bug_40528-rerun_db_rev_250501001.pl >new file mode 100755 >index 00000000000..02430851a96 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40528-rerun_db_rev_250501001.pl >@@ -0,0 +1,116 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40528", >+ description => "Define checkprevcheckout as ENUM (idempotent re-run)", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Check current column type for borrowers table >+ my $borrowers_column_info = $dbh->selectrow_hashref( >+ q{ >+ SHOW COLUMNS FROM borrowers >+ WHERE Field = 'checkprevcheckout' >+ } >+ ); >+ >+ if ( $borrowers_column_info && $borrowers_column_info->{Type} !~ /enum\('yes','no','inherit'\)/ ) { >+ >+ # Update invalid values before changing column type >+ my $updated_borrowers = $dbh->do( >+ q{ >+ UPDATE borrowers >+ SET checkprevcheckout = 'inherit' >+ WHERE checkprevcheckout NOT IN ('yes','no','inherit') >+ } >+ ); >+ >+ if ($updated_borrowers) { >+ say_info( $out, "Updated $updated_borrowers invalid checkprevcheckout values in borrowers table" ); >+ } >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE borrowers >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.' >+ } >+ ); >+ say_success( $out, "Updated borrowers.checkprevcheckout column to ENUM type" ); >+ } else { >+ say_info( $out, "borrowers.checkprevcheckout column already has correct ENUM type" ); >+ } >+ >+ # Check current column type for categories table >+ my $categories_column_info = $dbh->selectrow_hashref( >+ q{ >+ SHOW COLUMNS FROM categories >+ WHERE Field = 'checkprevcheckout' >+ } >+ ); >+ >+ if ( $categories_column_info && $categories_column_info->{Type} !~ /enum\('yes','no','inherit'\)/ ) { >+ >+ # Update invalid values before changing column type >+ my $updated_categories = $dbh->do( >+ q{ >+ UPDATE categories >+ SET checkprevcheckout = 'inherit' >+ WHERE checkprevcheckout NOT IN ('yes','no','inherit') >+ } >+ ); >+ >+ if ($updated_categories) { >+ say_info( $out, "Updated $updated_categories invalid checkprevcheckout values in categories table" ); >+ } >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE categories >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.' >+ } >+ ); >+ say_success( $out, "Updated categories.checkprevcheckout column to ENUM type" ); >+ } else { >+ say_info( $out, "categories.checkprevcheckout column already has correct ENUM type" ); >+ } >+ >+ # Check current column type for deletedborrowers table >+ my $deletedborrowers_column_info = $dbh->selectrow_hashref( >+ q{ >+ SHOW COLUMNS FROM deletedborrowers >+ WHERE Field = 'checkprevcheckout' >+ } >+ ); >+ >+ if ( $deletedborrowers_column_info && $deletedborrowers_column_info->{Type} !~ /enum\('yes','no','inherit'\)/ ) >+ { >+ # Update invalid values before changing column type >+ my $updated_deletedborrowers = $dbh->do( >+ q{ >+ UPDATE deletedborrowers >+ SET checkprevcheckout = 'inherit' >+ WHERE checkprevcheckout NOT IN ('yes','no','inherit') >+ } >+ ); >+ >+ if ($updated_deletedborrowers) { >+ say_info( >+ $out, >+ "Updated $updated_deletedborrowers invalid checkprevcheckout values in deletedborrowers table" >+ ); >+ } >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE deletedborrowers >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.' >+ } >+ ); >+ say_success( $out, "Updated deletedborrowers.checkprevcheckout column to ENUM type" ); >+ } else { >+ say_info( $out, "deletedborrowers.checkprevcheckout column already has correct ENUM type" ); >+ } >+ }, >+}; >-- >2.51.0
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 40528
:
184706
| 186394