Browse Source

Bug 20912: DBRev 18.12.00.021

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
19.05.x
Nick Clemens 5 years ago
parent
commit
cfe4d0e295
  1. 2
      Koha.pm
  2. 20
      Koha/Schema/Result/Itemtype.pm
  3. 19
      installer/data/mysql/atomicupdate/bug_20912.perl
  4. 20
      installer/data/mysql/updatedatabase.pl

2
Koha.pm

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "18.12.00.020";
$VERSION = "18.12.00.021";
sub version {
return $VERSION;

20
Koha/Schema/Result/Itemtype.pm

@ -41,6 +41,18 @@ __PACKAGE__->table("itemtypes");
is_nullable: 1
size: [28,6]
=head2 rentalcharge_daily
data_type: 'decimal'
is_nullable: 1
size: [28,6]
=head2 rentalcharge_hourly
data_type: 'decimal'
is_nullable: 1
size: [28,6]
=head2 defaultreplacecost
data_type: 'decimal'
@ -109,6 +121,10 @@ __PACKAGE__->add_columns(
{ data_type => "longtext", is_nullable => 1 },
"rentalcharge",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"rentalcharge_daily",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"rentalcharge_hourly",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"defaultreplacecost",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"processfee",
@ -226,8 +242,8 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GthTVMBLO5Zi6NU3up3m+A
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-07 17:30:46
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CDIOU6LmF7suaujk1NQOeg
# Use the ItemtypeLocalization view to create the join on localization
our $LANGUAGE;

19
installer/data/mysql/atomicupdate/bug_20912.perl

@ -1,19 +0,0 @@
$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', 'rentalcharge_hourly' ) ) {
$dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`");
}
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";
}

20
installer/data/mysql/updatedatabase.pl

@ -17551,6 +17551,26 @@ if( CheckVersion( $DBversion ) ) {
print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
}
$DBversion = '18.12.00.021';
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', 'rentalcharge_hourly' ) ) {
$dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`");
}
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";
}
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.

Loading…
Cancel
Save