From 64d29957894e67b0dfbd0599887eac355772a6b9 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 1 Jul 2016 08:19:50 +0200 Subject: [PATCH] Bug 10459: Update DB rev (3.22.08.001) --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 18 ++++++++++++++++-- Koha/Schema/Result/Deletedborrower.pm | 18 ++++++++++++++++-- .../atomicupdate/Bug10459_AddTimestampToBorrowers.sql | 8 -------- installer/data/mysql/updatedatabase.pl | 18 ++++++++++++++++++ 5 files changed, 51 insertions(+), 13 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql diff --git a/Koha.pm b/Koha.pm index f341fe8bab..223166c9bc 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 = "3.22.08.000"; +$VERSION = "3.22.08.001"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 1a7673e6cc..427c055070 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -395,6 +395,13 @@ __PACKAGE__->table("borrowers"); default_value: 1 is_nullable: 0 +=head2 updated_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -560,6 +567,13 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 50 }, "privacy", { data_type => "integer", default_value => 1, is_nullable => 0 }, + "updated_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -1153,8 +1167,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-10-21 19:50:05 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QafovaRBnm36nyoyQTGIgQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-07-01 08:14:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MhjMGmwPebVT85zsQtgKmg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm index 0632f51b79..a3fb035adf 100644 --- a/Koha/Schema/Result/Deletedborrower.pm +++ b/Koha/Schema/Result/Deletedborrower.pm @@ -393,6 +393,13 @@ __PACKAGE__->table("deletedborrowers"); default_value: 1 is_nullable: 0 +=head2 updated_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -546,11 +553,18 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 50 }, "privacy", { data_type => "integer", default_value => 1, is_nullable => 0 }, + "updated_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 1, + }, ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-02-26 14:46:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EDI8cewAT21LU7zuKc6LqA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-07-01 08:14:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XFvL47Af2HNisQA37/DIcA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql b/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql deleted file mode 100644 index dfd8940abd..0000000000 --- a/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql +++ /dev/null @@ -1,8 +0,0 @@ -ALTER TABLE borrowers - ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP - ON UPDATE CURRENT_TIMESTAMP - AFTER privacy; -ALTER TABLE deletedborrowers - ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP - ON UPDATE CURRENT_TIMESTAMP - AFTER privacy; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9d30f2b480..d9ea37422c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -11649,6 +11649,24 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.22.08.001"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + ALTER TABLE borrowers + ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP + AFTER privacy; + }); + $dbh->do(q{ + ALTER TABLE deletedborrowers + ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP + AFTER privacy; + }); + print "Upgrade to $DBversion done (Bug 10459 - borrowers should have a timestamp)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 -- 2.11.4.GIT