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

(-)a/installer/data/mysql/updatedatabase.pl (-8 / +18 lines)
Lines 10801-10812 if ( CheckVersion($DBversion) ) { Link Here
10801
        LEFT JOIN course_items USING(ci_id)
10801
        LEFT JOIN course_items USING(ci_id)
10802
        WHERE course_items.ci_id IS NULL
10802
        WHERE course_items.ci_id IS NULL
10803
    });
10803
    });
10804
    $dbh->do(q{
10804
10805
        ALTER IGNORE TABLE course_reserves
10805
    my $count_course_reserves_ibfk_2 = $dbh->selectrow_arrayref(q|
10806
            add CONSTRAINT course_reserves_ibfk_2
10806
        SELECT COUNT(*)
10807
                FOREIGN KEY (ci_id) REFERENCES course_items (ci_id)
10807
        FROM information_schema.table_constraints 
10808
                ON DELETE CASCADE ON UPDATE CASCADE
10808
        WHERE  table_schema = schema() 
10809
    });
10809
               AND table_name = 'course_reserves' 
10810
               AND CONSTRAINT_NAME = 'course_reserves_ibfk_2'
10811
    |);
10812
    #Add fk only if not present 
10813
    if ( $count_course_reserves_ibfk_2-->[0] == 0) {
10814
        $dbh->do(q{
10815
            ALTER IGNORE TABLE course_reserves
10816
                add CONSTRAINT course_reserves_ibfk_2
10817
                    FOREIGN KEY (ci_id) REFERENCES course_items (ci_id)
10818
                    ON DELETE CASCADE ON UPDATE CASCADE
10819
        });
10820
    };
10810
    print "Upgrade to $DBversion done (Bug 14205: Deleting an Item/Record does not remove link to course reserve)\n";
10821
    print "Upgrade to $DBversion done (Bug 14205: Deleting an Item/Record does not remove link to course reserve)\n";
10811
    SetVersion($DBversion);
10822
    SetVersion($DBversion);
10812
}
10823
}
Lines 10869-10875 if ( CheckVersion($DBversion) ) { Link Here
10869
$DBversion = "3.21.00.027";
10880
$DBversion = "3.21.00.027";
10870
if ( CheckVersion($DBversion) ) {
10881
if ( CheckVersion($DBversion) ) {
10871
    $dbh->do(q|
10882
    $dbh->do(q|
10872
        INSERT INTO permissions (module_bit, code, description)
10883
        INSERT IGNORE INTO permissions (module_bit, code, description)
10873
        VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID')
10884
        VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID')
10874
    |);
10885
    |);
10875
10886
10876
- 

Return to bug 15207