View | Details | Raw Unified | Return to bug 36687
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_36687.pl (+26 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36687",
5
    description => "Set itemtypes.notforloan to NOT NULL and tinyint(1)",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Do you stuffs here
11
        my $count_sql = q{SELECT COUNT(*) FROM itemtypes WHERE notforloan IS NULL};
12
        my ($count) = $dbh->selectrow_array($count_sql);
13
14
        if ($count) {
15
            $dbh->do(q{UPDATE itemtypes SET notforloan = 0 WHERE notforloan IS NULL});
16
            say $out "Updated $count columns where itemtypes.notforloan was NULL";
17
        }
18
        $dbh->do(
19
            q{
20
             ALTER TABLE itemtypes MODIFY COLUMN `notforloan` tinyint(1) NOT NULL DEFAULT 0
21
        }
22
        );
23
24
        say $out "Updated itemtypes.notforlaon column'";
25
    },
26
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +1 lines)
Lines 4138-4144 CREATE TABLE `itemtypes` ( Link Here
4138
  `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
4138
  `rentalcharge_hourly_calendar` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'controls if the hourly rental fee is calculated directly or using finesCalendar',
4139
  `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
4139
  `defaultreplacecost` decimal(28,6) DEFAULT NULL COMMENT 'default replacement cost',
4140
  `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
4140
  `processfee` decimal(28,6) DEFAULT NULL COMMENT 'default text be recorded in the column note when the processing fee is applied',
4141
  `notforloan` smallint(6) DEFAULT NULL COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
4141
  `notforloan` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1 if the item is not for loan, 0 if the item is available for loan',
4142
  `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
4142
  `imageurl` varchar(200) DEFAULT NULL COMMENT 'URL for the item type icon',
4143
  `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
4143
  `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML',
4144
  `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
4144
  `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in',
4145
- 

Return to bug 36687