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

(-)a/installer/data/mysql/db_revs/250600003.pl (-13 / +69 lines)
Lines 8-32 return { Link Here
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        $dbh->do(
11
        my $col_type_borrowers = $dbh->selectrow_array(
12
            q{
12
            q{
13
            ALTER TABLE borrowers
13
              SELECT COLUMN_TYPE
14
            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''.'
14
              FROM INFORMATION_SCHEMA.COLUMNS
15
        }
15
              WHERE TABLE_SCHEMA = DATABASE()
16
                AND TABLE_NAME = 'borrowers'
17
                AND COLUMN_NAME = 'checkprevcheckout'
18
            }
16
        );
19
        );
17
20
18
        $dbh->do(
21
        if ( $col_type_borrowers !~ /^enum/i ) {
19
            q{
22
            $dbh->do(
20
            ALTER TABLE categories
23
                q{
21
            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''.'
24
                    UPDATE borrowers
25
                    SET checkprevcheckout = 'inherit'
26
                    WHERE checkprevcheckout NOT IN ('yes','no','inherit');
27
                }
28
            );
29
            $dbh->do(
30
                q{
31
                    ALTER TABLE borrowers
32
                    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''.'
33
                }
34
            );
22
        }
35
        }
23
        );
24
36
25
        $dbh->do(
37
        my $col_type_categories = $dbh->selectrow_array(
26
            q{
38
            q{
27
            ALTER TABLE deletedborrowers
39
              SELECT COLUMN_TYPE
28
            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''.'
40
              FROM INFORMATION_SCHEMA.COLUMNS
41
              WHERE TABLE_SCHEMA = DATABASE()
42
                AND TABLE_NAME = 'categories'
43
                AND COLUMN_NAME = 'checkprevcheckout'
44
            }
45
        );
46
47
        if ( $col_type_categories !~ /^enum/i ) {
48
            $dbh->do(
49
                q{
50
                    UPDATE categories
51
                    SET checkprevcheckout = 'inherit'
52
                    WHERE checkprevcheckout NOT IN ('yes','no','inherit');
53
                }
54
            );
55
            $dbh->do(
56
                q{
57
                    ALTER TABLE categories
58
                    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''.'
59
                }
60
            );
29
        }
61
        }
62
63
        my $col_type_deletedborrowers = $dbh->selectrow_array(
64
            q{
65
              SELECT COLUMN_TYPE
66
              FROM INFORMATION_SCHEMA.COLUMNS
67
              WHERE TABLE_SCHEMA = DATABASE()
68
                AND TABLE_NAME = 'deletedborrowers'
69
                AND COLUMN_NAME = 'checkprevcheckout'
70
            }
30
        );
71
        );
72
73
        if ( $col_type_deletedborrowers !~ /^enum/i ) {
74
            $dbh->do(
75
                q{
76
                    UPDATE deletedborrowers
77
                    SET checkprevcheckout = 'inherit'
78
                    WHERE checkprevcheckout NOT IN ('yes','no','inherit');
79
                }
80
            );
81
            $dbh->do(
82
                q{
83
                    ALTER TABLE deletedborrowers
84
                    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''.'
85
                }
86
            );
87
        }
31
    },
88
    },
32
};
89
};
33
- 

Return to bug 40337