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

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

Return to bug 40337