Bug 22630: DBRev 19.12.00.081
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Apr 2020 16:11:13 +0000 (17:11 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Apr 2020 16:12:13 +0000 (17:12 +0100)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha.pm
installer/data/mysql/atomicupdate/bug-22630.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 1641e5b..5ecb7fe 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 = "19.12.00.080";
+$VERSION = "19.12.00.081";
 
 sub version {
     return $VERSION;
diff --git a/installer/data/mysql/atomicupdate/bug-22630.perl b/installer/data/mysql/atomicupdate/bug-22630.perl
deleted file mode 100644 (file)
index 1b7d483..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-$DBversion = 'XXX';
-if (CheckVersion($DBversion)) {
-    if (!column_exists('course_items', 'homebranch')) {
-        $dbh->do(q{
-            ALTER TABLE course_items
-            ADD COLUMN homebranch VARCHAR(10) NULL DEFAULT NULL AFTER ccode_storage
-        });
-    }
-
-    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch')) {
-        $dbh->do(q{
-            ALTER TABLE course_items
-            ADD CONSTRAINT fk_course_items_homebranch
-              FOREIGN KEY (homebranch) REFERENCES branches (branchcode)
-              ON DELETE CASCADE ON UPDATE CASCADE
-        });
-    }
-
-    if (!column_exists('course_items', 'homebranch_enabled')) {
-        $dbh->do(q{
-            ALTER TABLE course_items
-            ADD COLUMN homebranch_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER homebranch
-        });
-    }
-
-    if (!column_exists('course_items', 'homebranch_storage')) {
-        $dbh->do(q{
-            ALTER TABLE course_items
-            ADD COLUMN homebranch_storage VARCHAR(10) NULL DEFAULT NULL AFTER homebranch_enabled
-        });
-    }
-
-    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch_storage')) {
-        $dbh->do(q{
-            ALTER TABLE course_items
-            ADD CONSTRAINT fk_course_items_homebranch_storage
-              FOREIGN KEY (homebranch_storage) REFERENCES branches (branchcode)
-              ON DELETE CASCADE ON UPDATE CASCADE
-        });
-    }
-
-    SetVersion($DBversion);
-    print "Upgrade to $DBversion done (Bug 22630 - Add course_items.homebranch)\n";
-}
index 87be61e..bd2c6ef 100755 (executable)
@@ -21863,6 +21863,50 @@ if( CheckVersion( $DBversion ) ) {
     NewVersion( $DBversion, 23081, "Set default to 0 for items.issues");
 }
 
+$DBversion = '19.12.00.081';
+if (CheckVersion($DBversion)) {
+    if (!column_exists('course_items', 'homebranch')) {
+        $dbh->do(q{
+            ALTER TABLE course_items
+            ADD COLUMN homebranch VARCHAR(10) NULL DEFAULT NULL AFTER ccode_storage
+        });
+    }
+
+    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch')) {
+        $dbh->do(q{
+            ALTER TABLE course_items
+            ADD CONSTRAINT fk_course_items_homebranch
+              FOREIGN KEY (homebranch) REFERENCES branches (branchcode)
+              ON DELETE CASCADE ON UPDATE CASCADE
+        });
+    }
+
+    if (!column_exists('course_items', 'homebranch_enabled')) {
+        $dbh->do(q{
+            ALTER TABLE course_items
+            ADD COLUMN homebranch_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER homebranch
+        });
+    }
+
+    if (!column_exists('course_items', 'homebranch_storage')) {
+        $dbh->do(q{
+            ALTER TABLE course_items
+            ADD COLUMN homebranch_storage VARCHAR(10) NULL DEFAULT NULL AFTER homebranch_enabled
+        });
+    }
+
+    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch_storage')) {
+        $dbh->do(q{
+            ALTER TABLE course_items
+            ADD CONSTRAINT fk_course_items_homebranch_storage
+              FOREIGN KEY (homebranch_storage) REFERENCES branches (branchcode)
+              ON DELETE CASCADE ON UPDATE CASCADE
+        });
+    }
+
+    NewVersion( $DBversion, 22630, "Add course_items.homebranch");
+}
+
 # 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/';