Bug 36687: Update itemtypes.notforloan to not allow NULL values and change to tinyint(1)
To test:
1. Have some itemtypes.notforloan values set to NULL.
2. APPLY PACTH, updatedatabase, restart_all
3. When you updatedatabase those values should be set to 0.
4. Try updating an itemtypes.notforloan value to NULL. You cannot.
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d267e2fe17
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
76d5c13732
commit
85e37d730f
2 changed files with 27 additions and 1 deletions
26
installer/data/mysql/atomicupdate/bug_36687.pl
Executable file
26
installer/data/mysql/atomicupdate/bug_36687.pl
Executable file
|
@ -0,0 +1,26 @@
|
|||
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'";
|
||||
},
|
||||
};
|
|
@ -4114,7 +4114,7 @@ CREATE TABLE `itemtypes` (
|
|||
`rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
|
||||
`defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
|
||||
`processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
|
||||
`notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
|
||||
`notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
|
||||
`imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
|
||||
`summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
|
||||
`checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
|
||||
|
|
Loading…
Reference in a new issue