Bug 19724: DBRev 17.12.00.001
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Dec 2017 13:20:36 +0000 (10:20 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Dec 2017 13:21:57 +0000 (10:21 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha.pm
installer/data/mysql/atomicupdate/bug_19724.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 29c34a0..80fcf3d 100644 (file)
--- 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 (file)
index 968f998..0000000
+++ /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";
-}
index e10fd24..ec8760d 100755 (executable)
@@ -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.