From 94097761d518c37afab52ab91f8149d3b45e29d8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 29 Apr 2020 17:11:13 +0100 Subject: [PATCH] Bug 22630: DBRev 19.12.00.081 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- installer/data/mysql/atomicupdate/bug-22630.perl | 44 ---------------------- installer/data/mysql/updatedatabase.pl | 44 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug-22630.perl diff --git a/Koha.pm b/Koha.pm index 1641e5b..5ecb7fe 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.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 index 1b7d483..0000000 --- a/installer/data/mysql/atomicupdate/bug-22630.perl +++ /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"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 87be61e..bd2c6ef 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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/'; -- 1.7.2.5