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

(-)a/installer/data/mysql/db_revs/251200013.pl (-3 / +18 lines)
Lines 9-15 return { Link Here
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        if ( index_exists( 'items_last_borrower', 'itemnumber' ) ) {
11
        if ( index_exists( 'items_last_borrower', 'itemnumber' ) ) {
12
            $dbh->do('SET FOREIGN_KEY_CHECKS=0');
12
13
            # Drop existing foreign key
14
            $dbh->do(
15
                q{
16
                ALTER TABLE items_last_borrower
17
                DROP FOREIGN KEY items_last_borrower_ibfk_1
18
                }
19
            );
13
20
14
            # Drop the unique index
21
            # Drop the unique index
15
            $dbh->do(
22
            $dbh->do(
Lines 17-23 return { Link Here
17
                ALTER TABLE items_last_borrower DROP INDEX itemnumber
24
                ALTER TABLE items_last_borrower DROP INDEX itemnumber
18
            }
25
            }
19
            );
26
            );
20
            $dbh->do('SET FOREIGN_KEY_CHECKS=1');
27
28
            # Recreate foreign key
29
            $dbh->do(
30
                q{
31
                ALTER TABLE items_last_borrower
32
                ADD CONSTRAINT items_last_borrower_ibfk_1
33
                FOREIGN KEY (itemnumber) REFERENCES items (itemnumber)
34
                ON DELETE CASCADE ON UPDATE CASCADE
35
                }
36
            );
21
37
22
            say_success( $out, "Adjusted foreign key constraints on items_last_borrower table" );
38
            say_success( $out, "Adjusted foreign key constraints on items_last_borrower table" );
23
        }
39
        }
24
- 

Return to bug 42068