Lines 1-8
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
use Data::Dumper; |
|
|
3 |
|
2 |
|
4 |
return { |
3 |
return { |
5 |
bug_number => 29336, |
4 |
bug_number => 29390, |
6 |
description => "Add missing FK constraints to authorised value categories", |
5 |
description => "Add missing FK constraints to authorised value categories", |
7 |
up => sub { |
6 |
up => sub { |
8 |
my ($args) = @_; |
7 |
my ($args) = @_; |
Lines 18-23
return {
Link Here
|
18 |
); |
17 |
); |
19 |
|
18 |
|
20 |
my $sql; |
19 |
my $sql; |
|
|
20 |
my $cnt = 0; |
21 |
foreach my $table ( sort keys %fix_tables ) { |
21 |
foreach my $table ( sort keys %fix_tables ) { |
22 |
my $field = $fix_tables{$table}; |
22 |
my $field = $fix_tables{$table}; |
23 |
next if foreign_key_exists( $table, undef, $field ); |
23 |
next if foreign_key_exists( $table, undef, $field ); |
Lines 53-58
return {
Link Here
|
53 |
ON DELETE CASCADE ON UPDATE CASCADE |
53 |
ON DELETE CASCADE ON UPDATE CASCADE |
54 |
|; |
54 |
|; |
55 |
$dbh->do($sql); |
55 |
$dbh->do($sql); |
|
|
56 |
$cnt++; |
56 |
} |
57 |
} |
|
|
58 |
say $out "Added $cnt foreign key constraints."; |
57 |
}, |
59 |
}, |
58 |
} |
60 |
} |
59 |
- |
|
|