From 5393f59c53badee6bb4429a4299e8f4a6371e419 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 12 Oct 2022 11:17:09 +0000 Subject: [PATCH] Bug 31716: Prevent issues with foreign key VARCHAR is now allowed to be 65535 bytes max, as opposed to 255 - when testing this, however, I received errors about latering a column with a foreign key. Adding this to the update to avoid problems like bug 31673. Signed-off-by: David Nind --- .../data/mysql/atomicupdate/bug_31716_enlarge_av_column.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/atomicupdate/bug_31716_enlarge_av_column.pl b/installer/data/mysql/atomicupdate/bug_31716_enlarge_av_column.pl index 3e00083bb1..191bc94e3a 100755 --- a/installer/data/mysql/atomicupdate/bug_31716_enlarge_av_column.pl +++ b/installer/data/mysql/atomicupdate/bug_31716_enlarge_av_column.pl @@ -7,10 +7,15 @@ return { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; # Do you stuffs here + $dbh->do(q{ + ALTER TABLE illrequests DROP FOREIGN KEY illrequests_safk; + }); $dbh->do(q{ ALTER TABLE authorised_values MODIFY COLUMN authorised_value varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'code use to identify the authorized value'; }); - # Print useful stuff here + $dbh->do(q{ + ALTER TABLE illrequests ADD CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE + }); say $out "Column enlarged"; }, }; -- 2.30.2