diff --git a/installer/data/mysql/atomicupdate/bug_18639_add_replacementprice_field_to_aqorders.perl b/installer/data/mysql/atomicupdate/bug_18639_add_replacementprice_field_to_aqorders.perl index 004d6ab29b..152b14d0e7 100644 --- a/installer/data/mysql/atomicupdate/bug_18639_add_replacementprice_field_to_aqorders.perl +++ b/installer/data/mysql/atomicupdate/bug_18639_add_replacementprice_field_to_aqorders.perl @@ -1,6 +1,9 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - $dbh->do( "ALTER TABLE aqorders ADD COLUMN replacementprice DECIMAL(28,6)" ); + if( !column_exists( 'aqorders', 'replacementprice' ){ + $dbh->do( "ALTER TABLE aqorders ADD COLUMN replacementprice DECIMAL(28,6)" ); + $dbh->do( "UPDATE aqorders set replacementprice = rrp WHERE replacementprice IS NULL" ); + } SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 18639 - Add replacementprice field to aqorders table)\n"; }