From 3611a2cd6819fee960aacffd5f5f3dcc09d8a7ee Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 12 Oct 2020 09:13:18 +0000 Subject: [PATCH] Bug 26145: DBRev 20.06.00.049 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_xxxxx.perl | 29 ------------------- installer/data/mysql/updatedatabase.pl | 27 +++++++++++++++++ 3 files changed, 28 insertions(+), 30 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_xxxxx.perl diff --git a/Koha.pm b/Koha.pm index 15c568a50f..acf976bd87 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 = "20.06.00.048"; +$VERSION = "20.06.00.049"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx.perl b/installer/data/mysql/atomicupdate/bug_xxxxx.perl deleted file mode 100644 index 7e56febb5c..0000000000 --- a/installer/data/mysql/atomicupdate/bug_xxxxx.perl +++ /dev/null @@ -1,29 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - if( !column_exists( 'biblioimages', 'itemnumber' ) ) { - $dbh->do(q| - ALTER TABLE biblioimages - ADD COLUMN itemnumber INT(11) DEFAULT NULL - AFTER biblionumber; - |); - $dbh->do(q| - ALTER TABLE biblioimages - ADD FOREIGN KEY bibliocoverimage_fk2 (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE - |); - $dbh->do(q| - ALTER TABLE biblioimages MODIFY biblionumber INT(11) DEFAULT NULL - |) - } - - NewVersion( $DBversion, 'XXXXX', "Add the biblioimages.itemnumber column"); - - if( !TableExists('cover_images') ) { - $dbh->do(q| - ALTER TABLE biblioimages RENAME cover_images - |); - } - - # Always end with this (adjust the bug info) - NewVersion( $DBversion, "XXXXX", "Rename table biblioimages with cover_images"); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 03e9ed8cca..a571244f54 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23009,6 +23009,33 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 26529, "Remove blank default branch rules"); } +$DBversion = '20.06.00.049'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'biblioimages', 'itemnumber' ) ) { + $dbh->do(q| + ALTER TABLE biblioimages + ADD COLUMN itemnumber INT(11) DEFAULT NULL + AFTER biblionumber; + |); + $dbh->do(q| + ALTER TABLE biblioimages + ADD FOREIGN KEY bibliocoverimage_fk2 (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE + |); + $dbh->do(q| + ALTER TABLE biblioimages MODIFY biblionumber INT(11) DEFAULT NULL + |) + } + + if( !TableExists('cover_images') ) { + $dbh->do(q| + ALTER TABLE biblioimages RENAME cover_images + |); + } + + NewVersion( $DBversion, '26145', ["Add the biblioimages.itemnumber column", "Rename table biblioimages with cover_images"] ); +} + # 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/'; -- 2.20.1