From 270ff5cd1d399ae59a5f8f9b094a74cb834f1069 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 25 Apr 2024 09:58:19 +0100 Subject: [PATCH] Bug 29393: (QA follow-up) Make database update idempotent Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- .../Bug_29393_add_send_message_permission.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl diff --git a/installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl b/installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl old mode 100644 new mode 100755 index 12327f92be..1d8fe41c9d --- a/installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl +++ b/installer/data/mysql/atomicupdate/Bug_29393_add_send_message_permission.pl @@ -1,14 +1,16 @@ use Modern::Perl; return { - bug_number => "29393", + bug_number => "29393", description => "Add permission borrowers:send_messages_to_borrowers", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; - $dbh->do(q{INSERT INTO permissions (module_bit, code, description) - VALUES (4, 'send_messages_to_borrowers', 'Send messages to patrons')}); + $dbh->do( + q{INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES (4, 'send_messages_to_borrowers', 'Send messages to patrons')} + ); say $out "Update is going well so far"; }, -} + } -- 2.39.5