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

(-)a/installer/data/mysql/updatedatabase.pl (-2 / +2 lines)
Lines 16128-16134 if( CheckVersion( $DBversion ) ) { Link Here
16128
        unless ( foreign_key_exists('aqorders', 'aqorders_created_by') ) {
16128
        unless ( foreign_key_exists('aqorders', 'aqorders_created_by') ) {
16129
            $dbh->do( "ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" );
16129
            $dbh->do( "ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" );
16130
        }
16130
        }
16131
        $dbh->do( "UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby  WHERE aqorders.basketno = aqbasket.basketno AND aqorders.created_by IS NULL;" );
16131
        $dbh->do( "UPDATE aqbasket LEFT JOIN borrowers ON ( aqbasket.authorisedby = borrowers.borrowernumber ) SET aqbasket.authorisedby = NULL WHERE borrowers.borrowernumber IS NULL;" );
16132
        $dbh->do( "UPDATE aqorders LEFT JOIN aqbasket ON ( aqorders.basketno = aqbasket.basketno ) SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.created_by IS NULL;" );
16132
    }
16133
    }
16133
    SetVersion( $DBversion );
16134
    SetVersion( $DBversion );
16134
    print "Upgrade to $DBversion done (Bug 12395 - Save order line's creator)\n";
16135
    print "Upgrade to $DBversion done (Bug 12395 - Save order line's creator)\n";
16135
- 

Return to bug 22642