From 6adc4514c69a5fa95ff54caf73d2542e97769863 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Nov 2020 14:38:12 +0000 Subject: [PATCH] Bug 23019: DBRev 20.06.00.068 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug-23019.perl | 40 ------------------- installer/data/mysql/updatedatabase.pl | 36 +++++++++++++++++ 3 files changed, 37 insertions(+), 41 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug-23019.perl diff --git a/Koha.pm b/Koha.pm index d133a21034..f09e0e21db 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.067"; +$VERSION = "20.06.00.068"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug-23019.perl b/installer/data/mysql/atomicupdate/bug-23019.perl deleted file mode 100644 index 6facbd422a..0000000000 --- a/installer/data/mysql/atomicupdate/bug-23019.perl +++ /dev/null @@ -1,40 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - # you can use $dbh here like: - # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); - - # or perform some test and warn - if( !TableExists( 'import_batch_profiles' ) ) { - $dbh->do(q{ - CREATE TABLE `import_batch_profiles` ( -- profile for batches of marc records to be imported - `id` int(11) NOT NULL auto_increment, -- unique identifier and primary key - `name` varchar(100) NOT NULL, -- name of this profile - `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id) - `template_id` int(11) default NULL, -- the id of the marc modification template - `overlay_action` varchar(50) default NULL, -- how to handle duplicate records - `nomatch_action` varchar(50) default NULL, -- how to handle records where no match is found - `item_action` varchar(50) default NULL, -- what to do with item records - `parse_items` tinyint(1) default NULL, -- should items be parsed - `record_type` varchar(50) default NULL, -- type of record in the batch - `encoding` varchar(50) default NULL, -- file encoding - `format` varchar(50) default NULL, -- marc format - `comments` LONGTEXT, -- any comments added when the file was uploaded - PRIMARY KEY (`id`), - UNIQUE KEY `u_import_batch_profiles__name` (`name`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci - }); - } - - if(!column_exists('import_batches', 'profile_id')) { - $dbh->do(q{ - ALTER TABLE import_batches ADD COLUMN `profile_id` int(11) default NULL AFTER comments - }); - - $dbh->do(q{ - ALTER TABLE import_batches ADD CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL - }); - } - - # Always end with this (adjust the bug info) - NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches"); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ce22b53c65..b7ad69bba1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23350,6 +23350,42 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 20936, "Add new system preference OPACHoldsHistory"); } +$DBversion = '20.06.00.068'; +if( CheckVersion( $DBversion ) ) { + if( !TableExists( 'import_batch_profiles' ) ) { + $dbh->do(q{ + CREATE TABLE `import_batch_profiles` ( -- profile for batches of marc records to be imported + `id` int(11) NOT NULL auto_increment, -- unique identifier and primary key + `name` varchar(100) NOT NULL, -- name of this profile + `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id) + `template_id` int(11) default NULL, -- the id of the marc modification template + `overlay_action` varchar(50) default NULL, -- how to handle duplicate records + `nomatch_action` varchar(50) default NULL, -- how to handle records where no match is found + `item_action` varchar(50) default NULL, -- what to do with item records + `parse_items` tinyint(1) default NULL, -- should items be parsed + `record_type` varchar(50) default NULL, -- type of record in the batch + `encoding` varchar(50) default NULL, -- file encoding + `format` varchar(50) default NULL, -- marc format + `comments` LONGTEXT, -- any comments added when the file was uploaded + PRIMARY KEY (`id`), + UNIQUE KEY `u_import_batch_profiles__name` (`name`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + }); + } + + if(!column_exists('import_batches', 'profile_id')) { + $dbh->do(q{ + ALTER TABLE import_batches ADD COLUMN `profile_id` int(11) default NULL AFTER comments + }); + + $dbh->do(q{ + ALTER TABLE import_batches ADD CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL + }); + } + + NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches" ); +} + # 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