@@ -, +, @@ --- installer/data/mysql/atomicupdate/bug_20912.perl | 15 +++++++++++++++ installer/data/mysql/atomicupdate/bug_20912.sql | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_20912.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_20912.sql --- a/installer/data/mysql/atomicupdate/bug_20912.perl +++ a/installer/data/mysql/atomicupdate/bug_20912.perl @@ -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"; +} --- a/installer/data/mysql/atomicupdate/bug_20912.sql +++ a/installer/data/mysql/atomicupdate/bug_20912.sql @@ -1, +0,0 @@ -ALTER TABLE itemtypes ADD COLUMN rental_charge_daily decimal(28,6) default NULL AFTER rentalcharge; --