From ed3e4540d73c1c3009375ad339e09a2e676fa1bd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Aug 2020 08:00:23 +0000 Subject: [PATCH] Bug 21946: DBRev 20.06.00.022 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_21946.perl | 20 ------------------ installer/data/mysql/updatedatabase.pl | 21 +++++++++++++++++++ 3 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_21946.perl diff --git a/Koha.pm b/Koha.pm index e0cc507ff2..eab9021f42 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.021"; +$VERSION = "20.06.00.022"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_21946.perl b/installer/data/mysql/atomicupdate/bug_21946.perl deleted file mode 100644 index e5bbc86387..0000000000 --- a/installer/data/mysql/atomicupdate/bug_21946.perl +++ /dev/null @@ -1,20 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - unless ( column_exists('itemtypes', 'parent_type') ) { - $dbh->do(q{ - ALTER TABLE itemtypes - ADD COLUMN parent_type VARCHAR(10) NULL DEFAULT NULL - AFTER itemtype; - - }); - } - unless ( foreign_key_exists( 'itemtypes', 'itemtypes_ibfk_1') ){ - $dbh->do(q{ - ALTER TABLE itemtypes - ADD CONSTRAINT itemtypes_ibfk_1 - FOREIGN KEY (parent_type) REFERENCES itemtypes (itemtype) - }); - } - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 21946 - Add parent type to itemtypes)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 99371e4c6e..2fd83bfb02 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22552,6 +22552,27 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 25871, "Add library option to OpacItemLocation"); } +$DBversion = '20.06.00.022'; +if( CheckVersion( $DBversion ) ) { + unless ( column_exists('itemtypes', 'parent_type') ) { + $dbh->do(q{ + ALTER TABLE itemtypes + ADD COLUMN parent_type VARCHAR(10) NULL DEFAULT NULL + AFTER itemtype; + + }); + } + unless ( foreign_key_exists( 'itemtypes', 'itemtypes_ibfk_1') ){ + $dbh->do(q{ + ALTER TABLE itemtypes + ADD CONSTRAINT itemtypes_ibfk_1 + FOREIGN KEY (parent_type) REFERENCES itemtypes (itemtype) + }); + } + + NewVersion( $DBversion, 21946, "Add parent type to itemtypes" ); +} + # 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.39.5