From f2febaeac4d4567fd3d5dbaf64d69b7226378e0f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 3 Nov 2021 15:07:07 +0100 Subject: [PATCH] Bug 26326: DBRev 21.06.00.042 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_26326.perl | 14 ----------- installer/data/mysql/db_revs/210600042.pl | 23 +++++++++++++++++++ 3 files changed, 24 insertions(+), 15 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_26326.perl create mode 100644 installer/data/mysql/db_revs/210600042.pl diff --git a/Koha.pm b/Koha.pm index 3c0db2a7c9..9687b31536 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 = "21.06.00.041"; +$VERSION = "21.06.00.042"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_26326.perl b/installer/data/mysql/atomicupdate/bug_26326.perl deleted file mode 100644 index 000aedc9f7..0000000000 --- a/installer/data/mysql/atomicupdate/bug_26326.perl +++ /dev/null @@ -1,14 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - unless( - primary_key_exists('import_record_matches','import_record_id') && - primary_key_exists('import_record_matches','candidate_match_id') - ){ - if( primary_key_exists('import_record_matches' ) ){ - $dbh->do( "ALTER TABLE import_record_matches DROP PRIMARY KEY" ); - } - $dbh->do( "ALTER TABLE import_record_matches ADD PRIMARY KEY (import_record_id,candidate_match_id)" ); - } - - NewVersion( $DBversion, 26326, "Add primary key to import_record_matches"); -} diff --git a/installer/data/mysql/db_revs/210600042.pl b/installer/data/mysql/db_revs/210600042.pl new file mode 100644 index 0000000000..71ba24d5b5 --- /dev/null +++ b/installer/data/mysql/db_revs/210600042.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "26326", + description => "Add primary key to import_record_matches", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless( + primary_key_exists('import_record_matches','import_record_id') && + primary_key_exists('import_record_matches','candidate_match_id') + ){ + if( primary_key_exists('import_record_matches' ) ){ + $dbh->do(q| + ALTER TABLE import_record_matches DROP PRIMARY KEY + |); + } + $dbh->do(q| + ALTER TABLE import_record_matches ADD PRIMARY KEY (import_record_id,candidate_match_id) + |); + } + }, +} -- 2.39.5