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

(-)a/installer/data/mysql/atomicupdate/bug_38011-add_fk_to_subscriptions.pl (-3 / +12 lines)
Lines 16-21 return { Link Here
16
            }
16
            }
17
            );
17
            );
18
18
19
            my $fixed = $dbh->do(
20
                q{
21
                UPDATE subscription SET aqbooksellerid = NULL WHERE aqbooksellerid NOT IN (SELECT id FROM aqbooksellers)
22
                }
23
            );
24
            say_info(
25
                $out,
26
                "Updated $fixed subscriptions with NULL aqbooksellersid where aqbooksellerid was not found in aqbooksellers"
27
            ) if $fixed;
28
19
            $dbh->do(
29
            $dbh->do(
20
                q|
30
                q|
21
                ALTER TABLE subscription
31
                ALTER TABLE subscription
Lines 24-32 return { Link Here
24
                    REFERENCES aqbooksellers (id) ON DELETE SET NULL ON UPDATE CASCADE
34
                    REFERENCES aqbooksellers (id) ON DELETE SET NULL ON UPDATE CASCADE
25
            |
35
            |
26
            );
36
            );
27
            say_success( $out, "Updated foreign key 'subscription_ibfk_4'" );
37
            say_success( $out, "Added new foreign key 'subscription_ibfk_4'" );
28
        } else {
38
        } else {
29
            say_warning( $out, "Foreign key 'subscription_ibfk_4' already exists" );
39
            say_info( $out, "Foreign key 'subscription_ibfk_4' already exists" );
30
        }
40
        }
31
    },
41
    },
32
};
42
};
33
- 

Return to bug 38011