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

(-)a/installer/data/mysql/atomicupdate/bug_18887.perl (-18 / +22 lines)
Lines 21-43 if( CheckVersion( $DBversion ) ) { Link Here
21
        });
21
        });
22
    }
22
    }
23
23
24
    $dbh->do(q{
24
25
        INSERT INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
25
    if (column_exists('branch_borrower_circ_rules', 'max_holds') ){
26
        SELECT branchcode, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM branch_borrower_circ_rules
26
        $dbh->do(q{
27
    });
27
            INSERT IGNORE INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
28
28
            SELECT branchcode, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM branch_borrower_circ_rules
29
    $dbh->do(q{
29
        });
30
        INSERT INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
30
31
        SELECT NULL, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM default_borrower_circ_rules
31
        $dbh->do(q{
32
    });
32
            ALTER TABLE branch_borrower_circ_rules DROP COLUMN max_holds
33
33
        });
34
    $dbh->do(q{
34
    }
35
        ALTER TABLE branch_borrower_circ_rules DROP COLUMN max_holds
35
36
    });
36
    if (column_exists('default_borrower_circ_rules', 'max_holds') ){
37
37
        $dbh->do(q{
38
    $dbh->do(q{
38
            INSERT IGNORE INTO circulation_rules ( branchcode, categorycode, itemtype, rule_name, rule_value )
39
        ALTER TABLE default_borrower_circ_rules DROP COLUMN max_holds
39
            SELECT NULL, categorycode, NULL, 'max_holds', COALESCE( max_holds, '' ) FROM default_borrower_circ_rules
40
    });
40
        });
41
42
        $dbh->do(q{
43
            ALTER TABLE default_borrower_circ_rules DROP COLUMN max_holds
44
        });
45
    }
41
46
42
    SetVersion( $DBversion );
47
    SetVersion( $DBversion );
43
    print "Upgrade to $DBversion done (Bug 18887 - Introduce new table 'circulation_rules', use for 'max_holds' rules)\n";
48
    print "Upgrade to $DBversion done (Bug 18887 - Introduce new table 'circulation_rules', use for 'max_holds' rules)\n";
44
- 

Return to bug 18887