Bug 29605: Missing FK on tmp_holdsqueue.borrowernumber (tmp_holdsqueue_ibfk_3)
Bad copy paste on the foreign_key_exists condition Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
bb05b37f3e
commit
8022543d93
2 changed files with 15 additions and 3 deletions
|
@ -2,10 +2,10 @@ use Modern::Perl;
|
|||
|
||||
return {
|
||||
bug_number => "29605",
|
||||
description => "Add language_script_mapping primary key",
|
||||
description => "Resync DB structure for existing installations",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh) = @$args{qw(dbh)};
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
|
||||
if ( !primary_key_exists( 'language_script_mapping', 'language_subtag' )
|
||||
and index_exists( 'language_script_mapping', 'language_subtag' ) ) {
|
||||
|
@ -22,6 +22,18 @@ return {
|
|||
ALTER TABLE language_script_mapping
|
||||
ADD PRIMARY KEY `language_subtag` (`language_subtag`);
|
||||
});
|
||||
|
||||
say $out "Added missing primary key on language_script_mapping"
|
||||
}
|
||||
|
||||
unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) {
|
||||
$dbh->do(q{
|
||||
ALTER TABLE tmp_holdsqueue
|
||||
ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
});
|
||||
|
||||
say $out "Added missing foreign key on tmp_holdsqueue"
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ return {
|
|||
ADD CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
});
|
||||
}
|
||||
unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_2') ) {
|
||||
unless ( foreign_key_exists('tmp_holdsqueue', 'tmp_holdsqueue_ibfk_3') ) {
|
||||
$dbh->do(q{
|
||||
ALTER TABLE tmp_holdsqueue
|
||||
ADD CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|
|
Loading…
Reference in a new issue