diff --git a/installer/data/mysql/atomicupdate/bug_42988.pl b/installer/data/mysql/atomicupdate/bug_42988.pl new file mode 100755 index 0000000000..65b6064fc3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_42988.pl @@ -0,0 +1,28 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_success say_failure); + +return { + bug_number => "42988", + description => "Set holds_get_captured default to 1 in sip_accounts", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my $updated = $dbh->do(q{UPDATE sip_accounts SET holds_get_captured = 1 WHERE holds_get_captured IS NULL}); + if ($updated) { + say_success( + $out, + "Set holds_get_captured to 1 for " . ( $updated + 0 ) . " sip_accounts rows where it was NULL" + ); + } else { + say_failure( $out, "Failed to update NULL holds_get_captured rows in sip_accounts: " . $dbh->errstr ); + } + + my $altered = $dbh->do(q{ALTER TABLE sip_accounts ALTER COLUMN holds_get_captured SET DEFAULT 1}); + if ($altered) { + say_success( $out, "Changed default of 'holds_get_captured' in sip_accounts to 1" ); + } else { + say_failure( $out, "Failed to change default of 'holds_get_captured' in sip_accounts: " . $dbh->errstr ); + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index c7b1d13569..5a06277cb4 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6313,7 +6313,7 @@ CREATE TABLE `sip_accounts` ( `format_due_date` tinyint(1) DEFAULT NULL, `hide_fields` varchar(255) DEFAULT NULL, `holds_block_checkin` tinyint(1) DEFAULT NULL, - `holds_get_captured` tinyint(1) DEFAULT NULL, + `holds_get_captured` tinyint(1) DEFAULT 1, `inhouse_item_types` varchar(255) DEFAULT NULL, `inhouse_patron_categories` varchar(255) DEFAULT NULL, `login_id` varchar(255) NOT NULL COMMENT 'Staff userid for SIP2 authentication',