Bug 28308: DBrev

To remove the unnecessary entries from the DB

Signed-off-by: Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-10-16 12:46:21 +02:00 committed by Lucas Gass
parent ac724b8f06
commit 0a42444fee
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
use Modern::Perl;
use Koha::Installer::Output qw(say_warning say_success say_info);
return {
bug_number => "28308",
description => "Remove unnecessary message preference entries",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Remove message transport types entries for Advance notice (id=2) if "Days in advance" is 0 or NULL
$dbh->do(
q{
DELETE bmtp
FROM borrower_message_transport_preferences bmtp
JOIN borrower_message_preferences bmp
ON bmtp.borrower_message_preference_id = bmp.borrower_message_preference_id
WHERE bmp.message_attribute_id = 2
AND (bmp.days_in_advance = 0 OR bmp.days_in_advance IS NULL);
}
);
},
};