From 8915df00601d525e1823e03026f757a0b0e8de49 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 7 Dec 2017 10:20:36 -0300 Subject: [PATCH] Bug 19724: DBRev 17.12.00.001 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_19724.perl | 21 ------------------ installer/data/mysql/updatedatabase.pl | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_19724.perl diff --git a/Koha.pm b/Koha.pm index 29c34a0135..80fcf3de94 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 = "17.12.00.000"; +$VERSION = "17.12.00.001"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_19724.perl b/installer/data/mysql/atomicupdate/bug_19724.perl deleted file mode 100644 index 968f99810e..0000000000 --- a/installer/data/mysql/atomicupdate/bug_19724.perl +++ /dev/null @@ -1,21 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - foreach my $table (qw(biblio_metadata deletedbiblio_metadata)) { - if (!column_exists($table, 'timestamp')) { - $dbh->do(qq{ - ALTER TABLE `$table` - ADD COLUMN `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `metadata`, - ADD KEY `timestamp` (`timestamp`) - }); - $dbh->do(qq{ - UPDATE $table metadata - LEFT JOIN biblioitems ON (biblioitems.biblionumber = metadata.biblionumber) - LEFT JOIN biblio ON (biblio.biblionumber = metadata.biblionumber) - SET metadata.timestamp = GREATEST(biblioitems.timestamp, biblio.timestamp); - }); - } - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 19724 - Add [deleted]biblio_metadata.timestamp)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e10fd2406c..ec8760de7f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -15050,6 +15050,28 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Tē tōia, tē haumatia)\n"; } +$DBversion = '17.12.00.001'; +if( CheckVersion( $DBversion ) ) { + foreach my $table (qw(biblio_metadata deletedbiblio_metadata)) { + if (!column_exists($table, 'timestamp')) { + $dbh->do(qq{ + ALTER TABLE `$table` + ADD COLUMN `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `metadata`, + ADD KEY `timestamp` (`timestamp`) + }); + $dbh->do(qq{ + UPDATE $table metadata + LEFT JOIN biblioitems ON (biblioitems.biblionumber = metadata.biblionumber) + LEFT JOIN biblio ON (biblio.biblionumber = metadata.biblionumber) + SET metadata.timestamp = GREATEST(biblioitems.timestamp, biblio.timestamp); + }); + } + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19724 - Add [deleted]biblio_metadata.timestamp)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5