Bug 21729: DBRev 21.12.00.010
[koha.git] / installer / data / mysql / db_revs / 210600042.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "26326",
5     description => "Add primary key to import_record_matches",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9         unless(
10             primary_key_exists('import_record_matches','import_record_id') &&
11             primary_key_exists('import_record_matches','candidate_match_id')
12         ){
13             if( primary_key_exists('import_record_matches' ) ){
14                 $dbh->do(q|
15                     ALTER TABLE import_record_matches DROP PRIMARY KEY
16                 |);
17             }
18             $dbh->do(q|
19                 ALTER TABLE import_record_matches ADD PRIMARY KEY (import_record_id,candidate_match_id)
20             |);
21         }
22     },
23 }