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

(-)a/installer/data/mysql/db_revs/241200017.pl (-1 / +16 lines)
Lines 8-13 return { Link Here
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        my $sth = $dbh->prepare(
12
            q{
13
            SELECT COUNT(*) FROM illrequests WHERE borrowernumber NOT IN (SELECT borrowernumber FROM borrowers)
14
        }
15
        );
16
        $sth->execute;
17
        my $count = $sth->fetchrow_array;
18
19
        if ($count) {
20
            say_warning( $out, "Found $count illrequests with a borrowernumber that doesn't exist in borrowers" );
21
            $dbh->do(
22
                q{ UPDATE illrequests SET borrowernumber = NULL WHERE borrowernumber NOT IN (SELECT borrowernumber FROM borrowers) }
23
            );
24
            say_info( $out, "Set those borrowernumbers to NULL" );
25
        }
26
11
        $dbh->do(q{ ALTER TABLE illrequests DROP FOREIGN KEY illrequests_bnfk });
27
        $dbh->do(q{ ALTER TABLE illrequests DROP FOREIGN KEY illrequests_bnfk });
12
        $dbh->do(
28
        $dbh->do(
13
            q{
29
            q{
14
- 

Return to bug 40057