From 33bbbdd1a3af058896c00617f64c8972f5144a64 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 24 Mar 2020 11:26:17 +0000 Subject: [PATCH] Bug 24476: DBRev 19.12.00.053 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 8 ++++---- Koha/Schema/Result/Deletedborrower.pm | 8 ++++---- .../bug_24476_opt_out_of_auto_renewal.perl | 17 ----------------- installer/data/mysql/updatedatabase.pl | 18 ++++++++++++++++++ 5 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl diff --git a/Koha.pm b/Koha.pm index 9ab2cc18ab..4493e677bc 100644 --- a/Koha.pm +++ b/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 = "19.12.00.052"; +$VERSION = "19.12.00.053"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 0d2829dcbd..b2ef6c90ed 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -425,7 +425,7 @@ __PACKAGE__->table("borrowers"); data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: 'current_timestamp()' + default_value: current_timestamp is_nullable: 0 =head2 lastseen @@ -646,7 +646,7 @@ __PACKAGE__->add_columns( { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => "current_timestamp()", + default_value => \"current_timestamp", is_nullable => 0, }, "lastseen", @@ -1658,8 +1658,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-23 11:45:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SkCqcE0Wpja6r/hZ0yZLNA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-24 11:25:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6G2Szd+G4io5YH4nsxr2eg __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm index 0b22a83beb..3843bcc305 100644 --- a/Koha/Schema/Result/Deletedborrower.pm +++ b/Koha/Schema/Result/Deletedborrower.pm @@ -422,7 +422,7 @@ __PACKAGE__->table("deletedborrowers"); data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: 'current_timestamp()' + default_value: current_timestamp is_nullable: 0 =head2 lastseen @@ -631,7 +631,7 @@ __PACKAGE__->add_columns( { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => "current_timestamp()", + default_value => \"current_timestamp", is_nullable => 0, }, "lastseen", @@ -658,8 +658,8 @@ __PACKAGE__->add_columns( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-23 11:45:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fVl4c/8pymGaZBDR3EOrNg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-24 11:25:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kWv72D508m4D23rxA7QKCw __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl b/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl deleted file mode 100644 index 151c9b29c3..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl +++ /dev/null @@ -1,17 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - unless( column_exists('borrowers','autorenew_checkouts') ){ - $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" ); - } - unless( column_exists('deletedborrowers','autorenew_checkouts') ){ - $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" ); - } - $dbh->do(q{ - INSERT IGNORE INTO systempreferences - ( `variable`, `value`, `options`, `explanation`, `type` ) - VALUES - ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo') - }); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d247c1a020..4aae1adfbe 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21253,6 +21253,24 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 21443, "Add ability to exclude holidays when calculating rentals fees by time period"); } +$DBversion = '19.12.00.053'; +if( CheckVersion( $DBversion ) ) { + unless( column_exists('borrowers','autorenew_checkouts') ){ + $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" ); + } + unless( column_exists('deletedborrowers','autorenew_checkouts') ){ + $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1 AFTER anonymized" ); + } + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + ( `variable`, `value`, `options`, `explanation`, `type` ) + VALUES + ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo') + }); + + NewVersion( $DBversion, 24476, "Allow patrons to opt-out of autorenewal"); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5