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

(-)a/installer/data/mysql/atomicupdate/bug_35687.pl (-1 / +24 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "35687",
5
    description => "Upgrade to 23.06.00.013 may fail, drop fk and recreate after adding the pk to tmp_holdsqueue",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        unless ( primary_key_exists( 'tmp_holdsqueue', 'itemnumber' ) ) {
11
            $dbh->do(q{ALTER TABLE tmp_holdsqueue DROP CONSTRAINT `tmp_holdsqueue_ibfk_1`});
12
            $dbh->do(q{ALTER TABLE tmp_holdsqueue ADD PRIMARY KEY (itemnumber)});
13
            $dbh->do(
14
                q{
15
                    ALTER TABLE tmp_holdsqueue ADD CONSTRAINT `tmp_holdsqueue_ibfk_1`
16
                    FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`)
17
                    ON DELETE CASCADE ON UPDATE CASCADE
18
                }
19
            );
20
        }
21
22
        say $out "Set primary key for table 'tmp_holdsqueue' to 'itemnumber'";
23
    },
24
};

Return to bug 35687