|
Line 0
Link Here
|
| 0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
| 3 |
|
| 4 |
return { |
| 5 |
bug_number => "40517", |
| 6 |
description => "Add 'borrower' column to hold_groups", |
| 7 |
up => sub { |
| 8 |
my ($args) = @_; |
| 9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
| 10 |
|
| 11 |
unless ( column_exists( 'hold_groups', 'borrowernumber' ) ) { |
| 12 |
$dbh->do( |
| 13 |
q{ALTER TABLE hold_groups ADD COLUMN borrowernumber int(11) DEFAULT NULL COMMENT 'foreign key, linking this to the borrowers table' AFTER hold_group_id} |
| 14 |
); |
| 15 |
$dbh->do( |
| 16 |
q{ |
| 17 |
ALTER TABLE hold_groups ADD KEY `hold_groups_borrowernumber` (`borrowernumber`) |
| 18 |
} |
| 19 |
); |
| 20 |
$dbh->do( |
| 21 |
q{ |
| 22 |
ALTER TABLE hold_groups ADD CONSTRAINT hold_groups_ibfk_1 |
| 23 |
FOREIGN KEY(`borrowernumber`) |
| 24 |
REFERENCES `borrowers` (`borrowernumber`) |
| 25 |
ON DELETE CASCADE; |
| 26 |
} |
| 27 |
); |
| 28 |
say_success( $out, "Added column 'borrowernumber' to hold_groups" ); |
| 29 |
} |
| 30 |
}, |
| 31 |
}; |