Koha/installer/data/mysql/db_revs/231200050.pl
Katrin Fischer 3f9551b0c6
Bug 36687: DBRev 23.12.00.050
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-08 18:23:45 +02:00

26 lines
817 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => "36687",
description => "Set itemtypes.notforloan to NOT NULL and tinyint(1)",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Do you stuffs here
my $count_sql = q{SELECT COUNT(*) FROM itemtypes WHERE notforloan IS NULL};
my ($count) = $dbh->selectrow_array($count_sql);
if ($count) {
$dbh->do(q{UPDATE itemtypes SET notforloan = 0 WHERE notforloan IS NULL});
say $out "Updated $count columns where itemtypes.notforloan was NULL";
}
$dbh->do(
q{
ALTER TABLE itemtypes MODIFY COLUMN `notforloan` tinyint(1) NOT NULL DEFAULT 0
}
);
say $out "Updated itemtypes.notforlaon column'";
},
};