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

(-)a/installer/data/mysql/updatedatabase.pl (-11 / +32 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
     my @row;
10805
        ALTER IGNORE TABLE course_reserves
10805
     @row = $dbh->selectrow_arrayref(qq|
10806
            add CONSTRAINT course_reserves_ibfk_2
10806
        SHOW INDEXES FROM course_reserves WHERE key_name='course_reserves_ibfk_2'
10807
                FOREIGN KEY (ci_id) REFERENCES course_items (ci_id)
10807
    |);
10808
                ON DELETE CASCADE ON UPDATE CASCADE
10808
    #Add fk only if not present
10809
    });
10809
    unless ( @row ) {
10810
        $dbh->do(q{
10811
            ALTER IGNORE TABLE course_reserves
10812
                add CONSTRAINT course_reserves_ibfk_2
10813
                    FOREIGN KEY (ci_id) REFERENCES course_items (ci_id)
10814
                    ON DELETE CASCADE ON UPDATE CASCADE
10815
       });
10816
    }else{
10817
        $dbh->do(q{
10818
            ALTER IGNORE TABLE course_reserves
10819
                DROP FOREIGN KEY course_reserves_ibfk_2;
10820
        });
10821
        $dbh->do(q{
10822
            ALTER IGNORE TABLE course_reserves
10823
                DROP INDEX course_reserves_ibfk_2;
10824
        });
10825
        $dbh->do(q{
10826
            ALTER IGNORE TABLE course_reserves
10827
                add CONSTRAINT course_reserves_ibfk_2
10828
                    FOREIGN KEY (ci_id) REFERENCES course_items (ci_id)
10829
                    ON DELETE CASCADE ON UPDATE CASCADE
10830
        });
10831
    };
10810
    print "Upgrade to $DBversion done (Bug 14205: Deleting an Item/Record does not remove link to course reserve)\n";
10832
    print "Upgrade to $DBversion done (Bug 14205: Deleting an Item/Record does not remove link to course reserve)\n";
10811
    SetVersion($DBversion);
10833
    SetVersion($DBversion);
10812
}
10834
}
Lines 10869-10875 if ( CheckVersion($DBversion) ) { Link Here
10869
$DBversion = "3.21.00.027";
10891
$DBversion = "3.21.00.027";
10870
if ( CheckVersion($DBversion) ) {
10892
if ( CheckVersion($DBversion) ) {
10871
    $dbh->do(q|
10893
    $dbh->do(q|
10872
        INSERT INTO permissions (module_bit, code, description)
10894
        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')
10895
        VALUES (1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID')
10874
    |);
10896
    |);
10875
10897
Lines 11264-11274 if ( CheckVersion($DBversion) ) { Link Here
11264
        CREATE TABLE audio_alerts (
11286
        CREATE TABLE audio_alerts (
11265
            id int(11) NOT NULL AUTO_INCREMENT,
11287
            id int(11) NOT NULL AUTO_INCREMENT,
11266
            precedence smallint(5) unsigned NOT NULL,
11288
            precedence smallint(5) unsigned NOT NULL,
11267
            selector varchar(255) NOT NULL,
11289
            selector varchar(255) COLLATE utf8_unicode_ci NOT NULL,
11268
            sound varchar(255) NOT NULL,
11290
            sound varchar(255) COLLATE utf8_unicode_ci NOT NULL,
11269
            PRIMARY KEY (id),
11291
            PRIMARY KEY (id),
11270
            KEY precedence (precedence)
11292
            KEY precedence (precedence)
11271
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11293
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
11272
    });
11294
    });
11273
11295
11274
    $dbh->do(q{
11296
    $dbh->do(q{
11275
- 

Return to bug 15207