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

(-)a/installer/data/mysql/atomicupdate/bug_30497.pl (-1 / +16 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
3
return {
4
    bug_number => 30497,
5
    description => "Recreate old_reserves_ibfk_4 if cascading",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        my @info = $dbh->selectrow_array( q|SHOW CREATE TABLE old_reserves| );
11
        if( $info[1] =~ /^\s*CONSTRAINT .old_reserves_ibfk_4.*CASCADE$/m ) {
12
            $dbh->do( q|ALTER TABLE old_reserves DROP FOREIGN KEY old_reserves_ibfk_4| );
13
            $dbh->do( q|ALTER TABLE old_reserves ADD FOREIGN KEY old_reserves_ibfk_4 (itemtype) REFERENCES itemtypes (itemtype) ON DELETE SET NULL ON UPDATE SET NULL| );
14
        }
15
    },
16
};

Return to bug 30497