Bug 26326: DBRev 21.06.00.042

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-11-03 15:07:07 +01:00
parent ce2e85f56f
commit f2febaeac4
3 changed files with 24 additions and 15 deletions

View File

@ -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;

View File

@ -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");
}

View File

@ -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)
|);
}
},
}