From 378ea8db57afc0805704b6a7ef4931c500799d2d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 30 Apr 2024 13:58:38 +0100 Subject: [PATCH] Bug 35657: (follow-up) Add missing DB update Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- .../data/mysql/atomicupdate/bug_35657.pl | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_35657.pl diff --git a/installer/data/mysql/atomicupdate/bug_35657.pl b/installer/data/mysql/atomicupdate/bug_35657.pl new file mode 100755 index 0000000000..c02a2ff69c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_35657.pl @@ -0,0 +1,42 @@ +use Modern::Perl; + +return { + bug_number => "35657", + description => "Add assignee_id to tickets", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + unless ( column_exists( 'tickets', 'assignee_id' ) ) { + $dbh->do( + q{ + ALTER TABLE tickets ADD COLUMN assignee_id int(11) DEFAULT NULL COMMENT 'id of the user this ticket is assigned to' AFTER status + } + ); + $dbh->do( + q{ + ALTER TABLE tickets + ADD CONSTRAINT `tickets_ibfk_4` FOREIGN KEY (`assignee_id`) + REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + } + ); + say $out "Added column 'tickets.assignee_id'"; + } + + unless ( column_exists( 'ticket_updates', 'assignee_id' ) ) { + $dbh->do( + q{ + ALTER TABLE ticket_updates ADD COLUMN assignee_id int(11) DEFAULT NULL COMMENT 'id of the user this ticket was assigned to with this update' AFTER user_id + } + ); + $dbh->do( + q{ + ALTER TABLE ticket_updates + ADD CONSTRAINT `ticket_updates_ibfk_4` FOREIGN KEY (`assignee_id`) + REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + } + ); + say $out "Added column 'ticket_updates.assignee_id'"; + } + }, +}; -- 2.39.5