Bug 20912: (QA follow-up) Make DB Update idempotent
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
6fe5466e5a
commit
04ac65ba19
|
|
@ -0,0 +1,15 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if ( CheckVersion($DBversion) ) {
|
||||
|
||||
if ( !column_exists( 'itemtypes', 'rentalcharge_daily' ) ) {
|
||||
$dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_daily` decimal(28,6) default NULL AFTER `rentalcharge`");
|
||||
}
|
||||
|
||||
if ( column_exists( 'itemtypes', 'rental_charge_daily' ) ) {
|
||||
$dbh->do("UPDATE `itemtypes` SET `rentalcharge_daily` = `rental_charge_daily`");
|
||||
$dbh->do("ALTER TABLE `itemtypes` DROP COLUMN `rental_charge_daily`");
|
||||
}
|
||||
|
||||
SetVersion($DBversion);
|
||||
print "Upgrade to $DBversion done (Bug 20912 - Support granular rental charges)\n";
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE itemtypes ADD COLUMN rental_charge_daily decimal(28,6) default NULL AFTER rentalcharge;
|
||||
Loading…
Reference in New Issue