From f8c6d6fdd7cb0efdcf468bcd44dfe09b0aca5f47 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 13 Feb 2020 21:09:05 +0000 Subject: [PATCH] Bug 24289: DBRev 19.05.07.004 Signed-off-by: Lucas Gass --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_24289.perl | 31 ------------------ installer/data/mysql/updatedatabase.pl | 32 +++++++++++++++++++ 3 files changed, 33 insertions(+), 32 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24289.perl diff --git a/Koha.pm b/Koha.pm index ad4c7613c3..0073323eaa 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.05.07.003"; +$VERSION = "19.05.07.004"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_24289.perl b/installer/data/mysql/atomicupdate/bug_24289.perl deleted file mode 100644 index 231e1ab88b..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24289.perl +++ /dev/null @@ -1,31 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - if( !foreign_key_exists( 'repeatable_holidays', 'repeatable_holidays_ibfk_1' ) ) { - $dbh->do(q| - DELETE h - FROM repeatable_holidays h - LEFT JOIN branches b ON h.branchcode=b.branchcode - WHERE b.branchcode IS NULL; - |); - $dbh->do(q| - ALTER TABLE repeatable_holidays - ADD FOREIGN KEY repeatable_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE - |); - } - - if( !foreign_key_exists( 'special_holidays', 'special_holidays_ibfk_1' ) ) { - $dbh->do(q| - DELETE h - FROM special_holidays h - LEFT JOIN branches b ON h.branchcode=b.branchcode - WHERE b.branchcode IS NULL; - |); - $dbh->do(q| - ALTER TABLE special_holidays - ADD FOREIGN KEY special_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE - |); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24289 - Adding foreign keys on *_holidays.branchcode tables)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d00ec96ceb..9da61e121b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -18915,6 +18915,38 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 24206 - Update OpacSearchForTitleIn system preference)\n"; } +$DBversion = '19.05.07.004'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + if( !foreign_key_exists( 'repeatable_holidays', 'repeatable_holidays_ibfk_1' ) ) { + $dbh->do(q| + DELETE h + FROM repeatable_holidays h + LEFT JOIN branches b ON h.branchcode=b.branchcode + WHERE b.branchcode IS NULL; + |); + $dbh->do(q| + ALTER TABLE repeatable_holidays + ADD FOREIGN KEY repeatable_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + |); + } + + if( !foreign_key_exists( 'special_holidays', 'special_holidays_ibfk_1' ) ) { + $dbh->do(q| + DELETE h + FROM special_holidays h + LEFT JOIN branches b ON h.branchcode=b.branchcode + WHERE b.branchcode IS NULL; + |); + $dbh->do(q| + ALTER TABLE special_holidays + ADD FOREIGN KEY special_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + |); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24289 - Adding foreign keys on *_holidays.branchcode tables)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5